Sometimes you may face problems such as e-mails not being sent, delayed delivery or mail bouncing, issues while fetching e-mails, and login failures. In this recipe, we will learn how to identify the exact problem behind these issues. We will learn how to use debugging tools and read the logs of Postfix and Dovecot.
You will need access to a root account or an account with sudo
privileges.
It is assumed that you have already installed Postfix and Dovecot servers.
Follow these steps to troubleshoot the mail server:
stop/waiting
or not running
then the respective service is not running:$ sudo service postfix status $ sudo service dovecot status
/var/log/mail.log
:$ sudo service postfix restart $ less /var/log/mail.log
tail
command to monitor the stream of logs while the service is running. You can easily filter the output of tail
by piping it to a grep
command:$ tail -f /var/log/mail.log
Use grep
to only view selected logs:
$ tail -f /var/log/mail.log | grep "dovecot"
grep -v
to filter/remove selected logs:$ tail -f /var/log/mail.log | grep -v "dovecot"
/var/log/mail.err
and /var/log/upstart/dovecot.log
.You may want to enable verbose logging to get detailed debugging information. To enable debug mode on Dovecot, edit 10-logging.conf
and enable auth_verbose
and mail_debug
variables:
$ sudo nano /etc/dovecot/conf.d/10-logging.conf
auth_verbose = yes mail_debug = yes
Restart Dovecot:
$ sudo service dovecot restart
master.cf
file and add the -v
argument:$ sudo nano /etc/postfix/master.cf smtp inet n - - - - smtpd -v
Restart Postfix.
$ sudo nano /etc/postfix/master.cf smtp inet n - n - - smtpd
$ doveadm username [email protected]
$ postmap -q [email protected] mysql:/etc/postfix/mysql-virtual-maps
25
, 465
, 587
and Dovecot uses port 993
and 995
:$ telnet localhost 993
netstat
to make sure services are listening:$ sudo netstat -plutn
$ host -t mx example.com