In this blog post I am going to show you to configure your Laravel application to send email with Amazon AWS SES (Simple Emailing Service).
- A working Laravel web applicaiton
- A working set of AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY required to send email via SESORSMTP configuration settings for sending email via Amazon SMPT
- Mailing Writables as explained in the Laravel documentation
Steps to configure laravel application to send email with Amazon AWS SES in Laravel
- Open and edit your .env file which is found in root of your Laravel application
- Add or update your MAIL_MAILER settings to look like
Also add the following settings to .env
(Note: You can comment out or remove all other MAIL specific settings such as MAIL_HOST, MAIL_PORT etc. If you are using ses mailer method along with set of AWS_ACCESS_KEY_ID & AWS_SECRET_ACCESS_KEY. I will show you using amazon smtp settings in second method below)
- Open config/mail.php and set default mailer to ses12'default' => env('MAIL_MAILER', 'ses'),....
- Open config/services.php and set ses method:123456'default' => env('MAIL_MAILER', 'ses'),'ses' => ['key' => env('AWS_ACCESS_KEY_ID'),'secret' => env('AWS_SECRET_ACCESS_KEY'),'region' => env('AWS_DEFAULT_REGION'),],
- Open config/mail.php and set default mailer to ses
You can also add smtp settings directly to your .env file if you have got your Amazon smtp settings. In this method you dont need to edit mail.php and services.php files of your Laravel configuration.
Once setup your Laravel application should be able to send messages via Amazon SES or Amazon SMTP service.