Depending on the selected environment, e-mails get either sent to their designated recipient, or get saved into the users ~/tmp/ directory. This prevents you from accidental deliveries within non-PROD environments.
by now, this applies to PHP based applications which use the mail() function only
- on websites with the “PROD” environment setting, e-mails are delivered directly trough our SMTP cluster
- on websites with the “STAGE” or “DEV” environment setting, e-mails are saved as file into the ~/tmp/ directory
Analyze e-mails saved as file¶
Within all “STAGE” and “DEV” environments, e-mails are saved as file into the ~/tmp/ directory. The file name used is “mail.%Y-%m-%d_%H-%M-%S..eml”. You can access those e-mails trough different means:
$ cat ../tmp/mail.2015-06-26_10-11-06.ZuQ.eml To: email@example.com Subject: test X-PHP-Originating-Script: 0:test.php Hi there, this is the content.
Hint: Instead of
cat, use other commands like
analyze more complex e-mails
To analyze more complex e-mails, or even check things like HTML rendering, it is more feasible to open those e-mails within the client application of your choice. You can either copy the file to your local workstation, or just forward the whole e-mail to a given e-mail address.
Copy the desired file(s) (e.g.
your local workstation. Use your desired client such as Thunderbird to
open this file directly.
To forward a saved e-mail 1:1 (To, Cc, and Bcc within the file are evaluated), use the following command:
$ cat ~/tmp/mail.2015-06-26_10-11-06.ZuQ.eml | msmtp -t
To forward a saved e-mail to another recipient, use the following command:
$ cat ~/tmp/mail.2015-06-26_10-11-06.ZuQ.eml | msmtp firstname.lastname@example.org