Setting up e-mail notices

In this recipe, we are going to use the previous work to trigger an event that will send e-mails. E-mails are a slow process sometimes, so I will put them in a queue. In this case, it will be a database queue since it is just local communication. Once we are done, we will see how to send a "nice" looking e-mail.

Getting ready

A base Laravel install will do. I will be working from the previous work, but you can follow along.

How to do it…

  1. First, let's make our queue database tables:
    > php artisan queue:table && php artisan migrate
    
  2. Then, let's set this to sync in our .env file. Make sure that the QUEUE_DRIVER variable in your .env file looks like the example here:

    Queue driver setting in .env

  3. In the .enf file, we will set MAIL ...

Get Laravel 5.x Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.