src/XQueue/Maileon/API/Mailings/MailingsService.php
function addAttachmentFromFile($mailingId, $filename, $contentType, $attachmentFileName = null) {
        $handle = fopen($filename, "rb");
        if (FALSE === $filename) {
            throw new MaileonAPIException("Cannot read file " . $filename . ".");
        }
        $contents = '';
        while (!feof($handle)) {
            $contents .= fread($handle, 8192);
        }
        fclose($handle);
        if ($attachmentFileName === null) {
            $attachmentFileName = basename($filename);
        }
        
        return $this->addAttachment($mailingId, $attachmentFileName, $contentType, $contents);
    }
function addAttachmentFromFile($mailingId, $filename, $contentType, $attachmentFileName = null) {
        $handle = fopen($filename, "rb");
        if (FALSE === $filename) {
            throw new MaileonAPIException("Cannot read file " . $filename . ".");
        }
        $contents = '';
        while (!feof($handle)) {
            $contents .= fread($handle, 8192);
        }
        fclose($handle);
        if ($attachmentFileName === null) {
            $attachmentFileName = basename($filename);
        }
        
        return $this->addAttachment($mailingId, $attachmentFileName, $contentType, $contents);
    }
function addAttachmentFromFile ( $ mailingId , $ filename , $ contentType , $ attachmentFileName = null ) { $ handle = fopen ( $ filename , "rb" ) ; if ( FALSE === $ filename ) { throw new MaileonAPIException ( "Cannot read file " . $ filename . "." ) ; } $ contents = '' ; while ( ! feof ( $ handle ) ) { $ contents .= fread ( $ handle , 8192 ) ; } fclose ( $ handle ) ; if ( $ attachmentFileName === null ) { $ attachmentFileName = basename ( $ filename ) ; } return $ this -> addAttachment ( $ mailingId , $ attachmentFileName , $ contentType , $ contents ) ; }
Read a binary file from the file system and adds it as an attachment to this transaction.

@param type $mailingId
@param type $filename
@param type $contentType
@param type $attachmentFileName Name of the file in the attachments

@return com_maileon_api_MaileonAPIResult
@throws com_maileon_api_MaileonAPIException
Read a binary file from the file system and adds it as an attachment to this transaction .