I am no longer able to send emails since I updated my server from Ubuntu 13.04 to 14.04.
I have several websites installed in my server, and none of them is able to send emails any more. Before the update everything was working perfectly.
Some of the websites are based on Drupal, so they send emails using the Drupal emailing system. Other websites use phpmailer for that purpose.
I also tried to send an email directly with mail command, but this is not working, either. For example:
mail example@example.com
After several hours of investigation, I have no idea from where the problem could come from. I tried to remove/install all programs involved in emailing system such as:
postfix
Usually when I setup a new server and my websites are not able to send emails, I just install theses components and it solves the issue every time:
sudo apt-get install php-pear
sudo pear install mail
sudo pear install Net_SMTP
sudo pear install Auth_SASL
sudo pear install mail_mime
sudo apt-get install postfix
So I tried to uninstall/install also all of them, but it didn't help.
How can I diagnose this issue? My mail logs are not very helpful.
**** EDIT ****
After last procedure described above, I finally found something on mail.err file:
Dec 8 21:08:59 ns3268116 postfix/master[22716]: fatal: bind 0.0.0.0 port 25: Address already in use
Dec 8 21:52:37 ns3268116 postfix/master[27738]: fatal: bind 0.0.0.0 port 25: Address already in use
Also I found something special in mail.log, sometimes (I mean not every time):
Dec 8 19:07:27 ns3268116 postfix/smtp[11051]: A84F8120023: to=<my_email@gmail.com>, relay=gmail-smtp-in.l.google.com[2a00:1450:4013:c01::1b]:25, delay=1.8, delays=0.19/0/0.85/0.79, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[2a00:1450:4013:c01::1b] said: 550-5.7.1 [2001:41d0:8:5d63::1 12] Our system has detected that this 550-5.7.1 message is likely unsolicited mail. To reduce the amount of spam sent 550-5.7.1 to Gmail, this message has been blocked. Please visit 550-5.7.1 http://support.google.com/mail/bin/answer.py?hl=en&answer=188131 for 550 5.7.1 more information. v10si10884736wif.101 - gsmtp (in reply to end of DATA command))
**** EDIT 2 ****
As sendmail seems to be in conflict with postfix (see masegaloeh comment/answer), I uninstalled it and rebooted server. Here is what the logs said:
Dec 8 22:40:24 ns3268116 postfix/master[4447]: daemon started -- version 2.11.0, configuration /etc/postfix
Dec 8 22:40:24 ns3268116 postfix/pickup[4481]: BDDA9120427: uid=33 from=<admin@example.com>
Dec 8 22:40:24 ns3268116 postfix/cleanup[4483]: BDDA9120427: message-id=<20141208214024.BDDA9120427@ns3268116.ovh.net>
Dec 8 22:40:24 ns3268116 postfix/qmgr[4482]: BDDA9120427: from=<admin@example.com>, size=664, nrcpt=1 (queue active)
Dec 8 22:40:24 ns3268116 postfix/pickup[4481]: DD1FC12006A: uid=33 from=<admin@example.com>
Dec 8 22:40:24 ns3268116 postfix/cleanup[4483]: DD1FC12006A: message-id=<20141208214024.DD1FC12006A@ns3268116.ovh.net>
Dec 8 22:40:24 ns3268116 postfix/qmgr[4482]: DD1FC12006A: from=<admin@example.com>, size=863, nrcpt=1 (queue active)
Dec 8 22:40:28 ns3268116 postfix/smtp[4498]: DD1FC12006A: to=<corazonmonroemear@yahoo.com>, relay=mta7.am0.yahoodns.net[66.196.118.240]:25, delay=1331, delays=1328/0/2.3/0.84, dsn=2.0.0, status=sent (250 ok dirdel)
Dec 8 22:40:28 ns3268116 postfix/qmgr[4482]: DD1FC12006A: removed
Dec 8 22:40:56 ns3268116 postfix/smtp[4493]: connect to example.com[93.184.216.119]:25: Connection timed out
Dec 8 22:41:26 ns3268116 postfix/smtp[4493]: connect to example.com[2606:2800:220:6d:26bf:1447:1097:aa7]:25: Connection timed out
Dec 8 22:41:26 ns3268116 postfix/smtp[4493]: BDDA9120427: to=<admin@example.com>, relay=none, delay=1389, delays=1328/0.08/62/0, dsn=4.4.1, status=deferred (connect to example.com[2606:2800:220:6d:26bf:1447:1097:aa7]:25: Connection timed out)
And now when I do:
sudo netstat -tulpn | grep 25
I get:
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 7783/master
tcp6 0 0 127.0.0.1:8079 :::* LISTEN 4525/java
tcp6 0 0 :::8983 :::* LISTEN 4525/java
tcp6 0 0 :::25 :::* LISTEN 7783/master
And emails are still NOT being sent..
Actually now I can send emails with command mail. But it's weird because only the email defined on cc field is receiving the email.
Also the Drupal websites are again able to send emails.
But phpmailer is still not working. Anyone has an idea what's missing there??