Question

only subject is sending to the mail how i can send attached file and more form data laravel

Posted January 22, 2021 227 views
Laravel
Mail::send('index', [
            'name' => $request->get('name'),
            'email' => $request->get('email'),
            'file'=>  $request->get('file'),
            'contact' => $request->get('contact') ],
            function ($message) {
                    $message->from('XXXX@gmail.com');
                    $message->to('XXXX@gmail.com', 'System')
                    ->subject('New msg Received '); 

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi there,

You can attache a file to an email, with the following:

    $message->attach($pathToFile);

Here is a link to the official documentation for more information:

https://laravel.com/docs/8.x/mail#attachments

Hope that this helps!
Regards,
Bobby