Sometimes you wish to debug outgoing emails in the exim4 mail server. You can easily list the current mail queue using the mailq or exim -bp commands:
# exim -bp 46h 4.2K 1XEd7G-0005Wg-TD <> *** frozen *** root@localhost 17h 2.0K 1XF4UP-000322-SP <> *** frozen *** email@example.com 5m 3.7K 1XFKUl-0005YO-3Z <> *** frozen *** root@localhost
To see the reason for common problems, take a look at the /var/spool/exim4/msglog/<msgid> file:
# cat /var/spool/exim4/msglog/1XEd7G-0005Wg-TD 2014-08-05 13:41:18 Received from <> R=1XEd7E-0005Wb-IN U=Debian-exim P=local S=4302 2014-08-05 13:41:18 routing failed for firstname.lastname@example.org <root@localhost>: Unrouteable address *** Frozen (delivery error message)
You can also view the contents of a message with exim -Mvb <msgid>:
# exim -Mvb 1XF4UP-000322-SP 1XF4UP-000322-SP-D This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: XXX@hsr.ch SMTP error from remote mail server after RCPT TO:<XXX@hsr.ch>: host mxls2.ham.switch.ch [18.104.22.168]: 550 5.1.1 <XXX@hsr.ch>... User unknown ------ This is a copy of the message, including all the headers. ------ ...
For more options, see man exim.