So I have a ruby app that sends emails when there are errors, however it doesn't seem to be working. Here's the log for when that happens:
/var/log/mailerlog:
Sep 30 14:09:58 511914-db2 postfix/qmgr[1975]: 7794E5A02BD: removed
Sep 30 14:09:59 511914-db2 postfix/smtpd[9407]: connect from localhost[127.0.0.1]
Sep 30 14:09:59 511914-db2 postfix/smtpd[9407]: 2471A5A02BD: client=localhost[127.0.0.1]
Sep 30 14:09:59 511914-db2 postfix/cleanup[9410]: 2471A5A02BD: message-id=<[email protected]>
Sep 30 14:09:59 511914-db2 postfix/smtpd[9407]: disconnect from localhost[127.0.0.1]
Sep 30 14:09:59 511914-db2 postfix/qmgr[1975]: 2471A5A02BD: from=<[email protected]>, size=5354, nrcpt=1 (queue active)
Sep 30 14:09:59 511914-db2 postfix/smtp[9411]: connect to aspmx.l.google.com[2607:f8b0:4003:c02::1b]:25: Network is unreachable
Sep 30 14:09:59 511914-db2 postfix/smtp[9411]: 2471A5A02BD: to=<[email protected]>, relay=aspmx.l.google.com[173.194.64.27]:25, delay=0.31, delays=0.06/0/0.05/0.2, dsn=2.0.0, status=sent (250 2.0.0 OK 1380568199 xq2si1045224obc.109 - gsmtp)
However, when I try to send an email from the command line, it works:
echo "Test email sent from db2" | /usr/sbin/sendmail [email protected]
and this produces this in my /var/log/maillog:
echo "Test email sent from db2" | /usr/sbin/sendmail [email protected]
[mysite@511914-db2 ~]$ sudo su
[sudo] password for mysite:
[root@511914-db2 mysite]# cd /var/log
[root@511914-db2 log]# tail -f maillog
Sep 30 15:46:27 511914-db2 postfix/pickup[12986]: E78C05A0686: uid=502 from=<mysite>
Sep 30 15:46:27 511914-db2 postfix/cleanup[16776]: E78C05A0686: message-id=<[email protected]>
Sep 30 15:46:27 511914-db2 postfix/qmgr[1975]: E78C05A0686: from=<[email protected]>, size=349, nrcpt=1 (queue active)
Sep 30 15:46:27 511914-db2 postfix/smtp[16778]: connect to aspmx.l.google.com[2607:f8b0:4003:c02::1a]:25: Network is unreachable
Sep 30 15:46:28 511914-db2 postfix/smtp[16778]: E78C05A0686: to=<[email protected]>, relay=aspmx.l.google.com[173.194.64.27]:25, delay=0.4, delays=0.07/0.01/0.1/0.23, dsn=2.0.0, status=sent (250 2.0.0 OK 1380573988 pu10si1222849obb.113 - gsmtp)
Sep 30 15:46:28 511914-db2 postfix/qmgr[1975]: E78C05A0686: removed
From the looks of it, the emails are being sent. However, I'm not receiving anything except for when I run that command through the command line. Could it be disconnect from localhost[127.0.0.1]
that's screwing it up?
Let me know if you need more info and I'll paste it.
The last line in your first result says (among other things) "status=sent", as does the second-to-last line in the second output. This means that both times the message was sent successfully, accepted by the Gmail mail servers for delivery. Postfix tries to connect via IPv6 initially, and when that fails, it connects via IPv4. You need do nothing - everything is working correctly.