SimpleEmailServiceMessage::addAttachmentFromData PHP Method

addAttachmentFromData() public method

Add email attachment by directly passing the content
public addAttachmentFromData ( string $name, string $data, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : SimpleEmailServiceMessage
$name string The name of the file attachment as it will appear in the email
$data string The contents of the attachment file
$mimeType string Specify custom MIME type
$contentId string Content ID of the attachment for inclusion in the mail message
$attachmentType string Attachment type: attachment or inline
return SimpleEmailServiceMessage $this
    public function addAttachmentFromData($name, $data, $mimeType = 'application/octet-stream', $contentId = null, $attachmentType = 'attachment')
    {
        $this->attachments[$name] = array('name' => $name, 'mimeType' => $mimeType, 'data' => $data, 'contentId' => $contentId, 'attachmentType' => $attachmentType == 'inline' ? 'inline; filename="' . $name . '"' : $attachmentType);
        return $this;
    }