function addAttachmentFromBinaryData($filename, $mimetype, $contents) {
        $attachment = new Attachment($filename, $mimetype, base64_encode($contents));
        $this->attachments[] = $attachment;
    }