Laravel - Notifications - Raw Data Attachments
The attachData
method may be used to attach a raw string of bytes as an attachment. When calling the attachData
method, you should provide the filename that should be assigned to the attachment:
/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable)
{
return (new MailMessage)
->greeting('Hello!')
->attachData($this->pdf, 'name.pdf', [
'mime' => 'application/pdf',
]);
}