Working with Laravel and E-Mails

I’m working on a Project, where mails will be sent to users for several reasons. I read about some useful packages for Laravel help handle emails while in dev or test environments.

Catch E-Mails and save them into files

When you would like to see the generated content of an Email and don’t want to use a real SMTP-Server, where accidentaly emails could be sent to users, you could catch the sent mails and don’t deliver them effectively. For this I use laravel-mail-preview. It’s a little package saves sent mail to storage/email-previews, removes old ones (after set lifetime) and show automatically a link on the webpage where the email was send from (e.g. registration).

 

Test a E-Mails was sent

Same when you test your mails automatically with phpunit and such. Then Tighten Co.’s Package Mailthief will be your Friend. Which it you can intercept sending mails while testing and easy check the Subject was correct generated or the mail has a correct recipient.

Don’t forget to star these Project so you don’t forget them 😉

 

UPDATE: If you are on windows you could also use Papercut as a local simple Catch-All SMTP Server.

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top