Articles

How to Check the Status of Emails Sent by Your Apps

To see the status of emails being sent by your PHP apps, such as WordPress, you can look in the global Postfix mail log.

Postfix Mail Log

Your server uses Postfix to deliver mail. When PHP sends mail, it actually hands the email off to Postfix, which does the actual delivery of the mail.

To view the Postfix log file, SSH or SFTP into your server as root and follow this path:

/var/log/mail.log

For each email sent, multiple lines will appear in the log file, such as:

Feb 19 03:55:32 ip-10-161-74-52 postfix/pickup[11504]: BE78A40083: uid=1001 from=
Feb 19 03:55:32 ip-10-161-74-52 postfix/cleanup[12386]: BE78A40083: message-id=<20140219035532.BE78A40083@ip-10-161-74-52>
Feb 19 03:55:32 ip-10-161-74-52 postfix/qmgr[6843]: BE78A40083: from=, size=300, nrcpt=1 (queue active)
Feb 19 03:55:32 ip-10-161-74-52 postfix/smtp[12388]: connect to ASPMX.L.GOOGLE.com[2607:f8b0:400e:c03::1a]:25: Network is unreachable
Feb 19 03:55:33 ip-10-161-74-52 postfix/smtp[12388]: BE78A40083: to=, relay=ASPMX.L.GOOGLE.com[74.125.25.26]:25, delay=0.7, delays=0.03/0/0.11/0.56, dsn=2.0.0, status=sen
t (250 2.0.0 OK 1392782133 gx4si20423908pbc.51 - gsmtp)
Feb 19 03:55:33 ip-10-161-74-52 postfix/qmgr[6843]: BE78A40083: removed

Your log will look different for each email. In the particular example above, Postfix tried to connect to Gmail's SMTP servers using IPv6, failed, and then succeeded with IPv4. The email was successfully sent and removed from the local mail queue.