Mails are not being sent

From Linuxintro

I had the problem that mails were not sent from the mail server to other mail servers. The mails could be seen with the command mailq like this:

root@mail:/etc# lsb_release -d
Description:    Ubuntu 14.04.3 LTS
root@mail:~# mailq 
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
C3580220AC*   32415 Wed Dec 30 07:49:01  thorsten@example.com

Ok, /var/log/mail.err had a million entries

Jan  2 17:17:35 mail postfix/smtp[24439]: fatal: specify a password table via the `smtp_sasl_password_maps' configuration parameter

I had /etc/postfix as config directory for mail, and I had a backup of older configurations in /etc/postfix-1 and /etc/postfix-2. The command

diff -rup /etc/postfix /etc/postfix-2

showed me that I had made changes in /etc/postfix/main.cf:

-smtp_sasl_auth_enable = yes
-smtp_sasl_security_options = 

So I copied this file back and restarted postfix:

root@mail:/etc# cp -r /etc/postfix-2/main.cf /etc/postfix
root@mail:/etc# /etc/init.d/postfix restart

Then the command mailq only delivered 2 requests that had failed. And this due to a wrong recipient address.

What have we learned here?

  • check the status of your mails using the command
mailq
  • in case of problems examine the log und /var/log/mail.info and /var/log/mail.err
  • the mailing service is called postfix. It can be configured under /etc/postfix and restarted with the command /etc/init.d/postfix restart (Ubuntu 14.04)
  • practice backups of your /etc/postfix folder!