Every now and then, you come across developing an application, that sends email. How to simple test this application? It’s easy, if you have an own mail server. For Windows, there is the very simple smtp4dev application, that listens on localhost port 25 and displays all emails that would have been transmitted. A similar but cross-platform tool is FakeSMTP. For a server, fakemail might be worth a look at.
However, all these solutions only work, if your application uses TCP to send a mail, but what about
sendmail. This is a typical solution for PHP applications - they just handover the mail to sendmail
and let sendmail deliver it.
Luckily, there is an easy solution - at least, if you are running Debian and exim4: As described in Basic Exim configuration to redirect all outbound emails you’ll need to do the following:
Create a file
/etc/exim4/conf.d/router/01_catch-all-outgoingwith the following content:
catch_all_outgoing: debug_print = "R: to andreas" driver = redirect data = andreas
Of course - replace “andreas” with your local user account.
Make sure, to have set
/etc/exim4/update-exim4.conf.conf. This configures Debian to generate the final exim configuration based on the files in
Regenerate the final exim configuration with
sudo update-exim4.confand restart exim with
sudo service exim4 restart.
Configure Thunderbird and add a local mail account: Menu “Edit”, “Account Settings”, “Account Actions”, “Add Other Account” and select “Unix Mailspool (Movemail)” and follow the wizard.
You can test your setup, by sending a mail on the command line, e.g.
cat <<EOF | sudo sendmail email@example.com From: firstname.lastname@example.org To: email@example.com Subject: test mail from command line Hello World! EOF
You email should be arriving now in Thunderbird.