Route::get('send-email-pdf', ) Step 5 – Create Directory And Blade View
And then add the following routes for send email: use App\Http\Controllers\SendEmailController Visit to routes directory and open web.php file. Run the following command on terminal to publish package’s config file to your config directory by using following command: php artisan vendor:publish Step 4 – Add Send Email Route 'PDF' => niklasravnsborg\LaravelPdf\Facades\Pdf::class Niklasravnsborg\LaravelPdf\PdfServiceProvider::class To start using Laravel, add the Service Provider and the Facade to your config/app.php: 'providers' => [ Run the following command on terminal to install PDF package to generate PDF: composer require niklasravnsborg/laravel-pdf Once less secure apps are enabled now you can use your Gmail for sending the emails. Note that:- If you are sending a mail using Gmail you have to allow non-secure apps to access Gmail you can do this by going to your Gmail settings here. env file like following: MAIL_DRIVER=smtp MAIL_HOST= MAIL_PORT=587 MAIL_USERNAME=Add your user name here MAIL_PASSWORD=Add your password here MAIL_ENCRYPTION=tls In this step, you need to configure smtp details in. Run following command on command prompt to install or download laravel 9 application: composer create-project -prefer-dist laravel/laravel blog Step 2 – Configuration SMTP in.
#Sending an email with an pdf attachment using smtp command how to#
To send email with attachment laravel 9 Through this tutorial, i am going to show you how to send email with attachment (pdf, word, txt etc file) in laravel 9 apps.