src/XQueue/Maileon/API/Transactions/Transaction.php
function addAttachmentFromFile($filename, $mimetype, $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);
        }
        $attachment = new Attachment($attachmentFileName, $mimetype, base64_encode($contents));
        $this->attachments[] = $attachment;
    }
function addAttachmentFromFile($filename, $mimetype, $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);
        }
        $attachment = new Attachment($attachmentFileName, $mimetype, base64_encode($contents));
        $this->attachments[] = $attachment;
    }
Read a binary file from the file system and adds it as an attachment to this transaction.
@param $filename the file system path to read the attachment from
@param $mimetype the mime type of the attachment
@param null $attachmentFileName the file name to use when sending the attachment as an e-mail. If this is null,
the basename of $filename is used instead.