When I'm developing using the Drupal Development VM, or checking into email processing on any of my servers, I usually use postfix to handle mail sending. Postfix is simple, preinstalled on most Linux distributions (and easy to set up if not), and is easy enough to use.
Here are the most common commands I use when either developing or troubleshooting email in production:
mailq
- print a list of all queued mailpostcat -vq [message-id]
- print a particular message, by ID (you can see the ID along inmailq
's output)postqueue -f
- process the queued mail immediatelypostsuper -d ALL
- delete ALL queued mail (use with caution—but handy if you have a mail send going awry!)
There are many other helpful commands and scripts to help deal with mail (e.g. deleting all messages to a certain domain, or deleting specific message IDs easily), but these are the main ones I use during day-to-day development and troubleshooting.
Comments
Jeff, thanks so much for all you do. I've spent the past couple months slowly making my way through Ansible for Devops and watching your Ansible series on YouTube. I stumbled onto this page by coincidence when searching around the web for some postfix info while I was setting up an alert for a FreePBX system. I didn't even notice the site was yours at first, but the examples were exactly what I was after. Even though this post is several years old, I wanted to drop a note and let you know that your work is appreciated.
Thanks! I'm glad I can help :)