A bunch of solutions is documented in the Drupal Community Documentation: Managing Mail Handling for Development or Testing.
Personally I prefer a combination of a local Postfix mail server, the Reroute Email module, and rerouting to a local mailbox. This has the advantage that you don't have to go through the trouble of setting up your local host to successfully send to external e-mail addresses without being rejected as a possible spammer. How to set it up:
- Install postfix. The default configuration under Ubuntu will work for our purposes.
Make sure your relevant php.ini
is set up to use postfix by containing these two lines. Contrary to the comments there, these settings are not just used on Win32 systems.
SMTP = localhost
smtp_port = 25
Install the Reroute Email module: drush dl reroute_email && drush en reroute-email
.
- In the configuration settings for Reroute Email, set the target addres to your Linux username (such as
matt
, no @hostname.tld
part here). These e-mails arrive in your local mailbox in /var/spool/
then.
- Set up Thunderbird to fetch these e-mails: Go to "Edit → Account Settings → Add Other Account… → Type: Unix Mailspool (Movemail)" and use these settings:
- "E-Mail Address": again use your Linux username (such as
matt
) but determine your hostname (hostname
command) and add it hostname behind in the format username@hostname
.
- "Your Name" and "Account Name": anything will work, this is just cosmetics.