How to Debug Emails In Drupal
It only takes a few minutes to set up
If you are working on a task in Drupal that involves sending e-mails, it might not be straightforward to set it up locally. This is a way of doing it, but if you use Lando or DDEV you can use as well Mailhog or Mailpit, although those take some time to configure as well.
This method requires only the installation of one module: Maillog, and some easy configuration.
- First, run the composer require command from the link above to download the module.
- Then, enable the module: drush en maillog -y
- Then, go to admin/config/system/mailsystem and select Maillog as a formatter:
- Now, let’s configure the module by going to admin/config/development/maillog and unchecking the first checkbox (just in case):
- Now, if you go to admin/reports/maillog, you will see the e-mails not being sent and each of their values:
And that’s it, with just a few steps you can easily debug e-mails locally. Just make sure you don’t push any maillog related change to the live site.
👉 Find out more about me here: https://sergioguardiola.net 🔥