How to send an attachment from request to mail without first saving it to storage?
$email = $this->from('mymail@gmail.com')
->view('emails.contact');
foreach(request()->file() as $file) {
$email->attach($file->getRealPath(), [
'as' => $file->getClientOriginalName(),
'mime' => $file->getMimeType(),
]);
}
}
return $email;
You can see it in the documentation https://laravel.com/docs/9.x/mail#attachments
No comments:
Post a Comment