SimpleEmailServiceMessage::addAttachmentFromUrl PHP Method

addAttachmentFromUrl() public method

Add email attachment by passing file path
public addAttachmentFromUrl ( string $name, string $url, string $mimeType = 'application/octet-stream', string $contentId = null, string $attachmentType = 'attachment' ) : boolean
$name string The name of the file attachment as it will appear in the email
$url string URL to 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 boolean Status of the operation
    public function addAttachmentFromUrl($name, $url, $mimeType = 'application/octet-stream', $contentId = null, $attachmentType = 'attachment')
    {
        $data = file_get_contents($url);
        if ($data !== false) {
            $this->addAttachmentFromData($name, $data, $mimeType, $contentId, $attachmentType);
            return true;
        }
        return false;
    }