public function addAttachment($filePath) {
        if (!$file = fopen($filePath, 'r')) {
            throw new Exception('Cannot open file "' . $filePath . '"');
        }

        $this->attachments[$filePath] = chunk_split(base64_encode(fread($file, filesize($filePath))));
        return $this;
    }
public function addAttachment($filePath) {
        if (!$file = fopen($filePath, 'r')) {
            throw new Exception('Cannot open file "' . $filePath . '"');
        }

        $this->attachments[$filePath] = chunk_split(base64_encode(fread($file, filesize($filePath))));
        return $this;
    }
public function addAttachment ( $ filePath ) { if ( ! $ file = fopen ( $ filePath , 'r' ) ) { throw new Exception ( 'Cannot open file "' . $ filePath . '"' ) ; } $ this -> attachments [ $ filePath ] = chunk_split ( base64_encode ( fread ( $ file , filesize ( $ filePath ) ) ) ) ; return $ this ; }
Attach a file to the email
@param string $filePath Path to the file
@return \Email
@throws Exception
Attach a file to the email