Outbound mail delivery logs
When your server sends an email, the delivery of the email to the recipient’s mail server is handled by a service known as a Mail Transfer Agent (MTA). Your server is configured to use an industry-standard MTA called Postfix. For every email your server sends, the logs generated by Postfix show whether the email was successfully delivered and, if the email was not delivered, the reason delivery failed.
View the logs
A server’s mail delivery logs can be viewed from within the ServerPilot dashboard or through SSH.
Log file location
Logs of all email deliveries attempted by your server are in the file:
/var/log/mail.log
Ubuntu also writes the mail logs to the systemd journal,
so the same mail log entries can be viewed in /var/log/syslog
or using journalctl
.
Log file format
For each email sent, there will be multiple log entries.
The following example shows a set of log messages for the delivery of a single email:
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 unreachableFeb 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=sent (250 2.0.0 OK 1392782133 gx4si20423908pbc.51 - gsmtp)Feb 19 03:55:33 ip-10-161-74-52 postfix/qmgr[6843]: BE78A40083: removed
In the example above, Postfix tried to connect to Gmail’s SMTP servers using IPv6, failed to connect using IPv6, and then succeeded using IPv4. The email was successfully sent and removed from the local mail queue.
Example commands
View recent mail log entries
View the 100 most recent entries in a server’s mail log
(requires logging in as root
):
sudo tail -n 100 /var/log/mail.log