Send email with Amazon AWS SES in Laravel 8

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).

Send email with Amazon AWS SES in Laravel 8

Prerequisites

  1. A working Laravel web applicaiton
  2. 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
  3. 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 ses
    • Open config/services.php and set ses method:

Second method

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.

Clear your Laravel Application cache. An effective way to clear your laravel applicaiton cache is demonstrated here.

Once setup your Laravel application should be able to send messages via Amazon SES or Amazon SMTP service.

Leave a Reply