3

After upgrading a server from Ubuntu 10.04 to 12.04, postfix is no longer sending email through sendgrid.com. I followed this guide about 6 months ago and everything had been working perfectly until the upgrade. Now it doesn't seem to be authenticating with sendgrid.

This is the error I get in my syslog when I try to send an email.

May 22 10:19:55 server postfix/smtp[3844]: 983B11C5DA: to=<to address>, 
relay=smtp.sendgrid.net[174.36.32.204]:587, delay=0.05, delays=0.01/0/0.04/0,
dsn=5.0.0, status=bounced (host smtp.sendgrid.net[174.36.32.204] said: 550 Cannot
receive from specified address <sendgrid username>: Unauthenticated senders not
allowed (in reply to MAIL FROM command))

This is from postconf -n

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = no
config_directory = /etc/postfix
header_size_limit = 4096000
inet_interfaces = loopback-only
mailbox_size_limit = 0
mydestination = localhost, mylinode.members.linode.com
myhostname = hostname
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost = [smtp.sendgrid.net]:587
smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter = login
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sendgrid
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

Any help would be greatly appreciated. I would be happy to post any other logs or other relevant information.

Luke
  • 131
  • 1
  • 4
  • Maybe you need to re-hash your /etc/postfix/sasl/sendgrid file ? – Dom May 22 '12 at 16:37
  • I did. Before I did that I was getting this error: `May 22 10:06:34 server postfix/smtp[1891]: fatal: SASL per-connection initialization failed` – Luke May 22 '12 at 17:03
  • http://stackoverflow.com/questions/9791735/fix-postfix-authentication-for-sendgrid – Dom May 22 '12 at 17:07
  • http://docs.sendgrid.com/documentation/get-started/integrate/examples/postfix/ – Dom May 22 '12 at 17:11
  • Any other updates on this? Still experiencing the issue after rehash? – Swift May 22 '12 at 22:46
  • It turns out that it wasn't a rehash that it needed, but the format of the file was incorrect. It looked like `[smtp.sendgrid.net] username:password` but it didn't need the brackets around the host name. In my hunt for answers somewhere I saw that it was required and someone even said to put the port behind it, but neither was necessary. – Luke May 24 '12 at 02:10

2 Answers2

4

I had a similar error. I fixed it by commenting out:

#default_transport = error
#relay_transport = error
user138376
  • 41
  • 2
1

cited from the commment:

"It turns out that it wasn't a rehash that it needed, but the format of the file was incorrect. It looked like [smtp.sendgrid.net] username:password but it didn't need the brackets around the host name. In my hunt for answers somewhere I saw that it was required and someone even said to put the port behind it, but neither was necessary."

mailq
  • 16,882
  • 2
  • 36
  • 66