How to send an attachment from request to mail without first saving it to storage?


How to send an attachment from request to mail without first saving it to storage?

public function build(){
    $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


Comments

Popular posts from this blog

Android App Version Update using the following cordova cli commands

75 inspirational quotes that will change your life

Retrieval Image From DataBase and Display on WebPage by Using Servlets.