2

I currently have a working mailserver with Postfix and Dovecot with virtual mailboxes in mySQL. However, I have a problem setting Sendgrid as relayhost.

As said, the authentication is done as follows:

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

I also use TLS and the certificates are pointed to correctly.

Now, when I follow Sendgrid's guide:

smtp_sasl_auth_enable = yes 
smtp_sasl_password_maps = static:yourSendGridUsername:yourSendGridPassword 
smtp_sasl_security_options = noanonymous 
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587

(username and password changed), I am not quite sure how the authentication is done. It simply doesn't work, as I receive an error message from Sendgrid with:

"550 Cannot receive from specified address : Unauthenticated senders not allowed (in reply to MAIL FROM command)"

If I remove the Dovecot part, obviously the e-mail cannot be sent in the first place because it is not allowed to connect to the mailserver.

Any thoughts?

2 Answers2

2

Port 587 uses unencrypted or TLS encryption when sending out the emails. Check if this line is inside the main.cf file:

start_tls=yes

Also, try to use port 2525 as an alternative, as port 587 might be blocked by your ISP. To check if the port is blocked, try doing a telnet test.

VictorA
  • 41
  • 2
  • Thanks for your input VictorA. However, "start_tls" is not a valid Postfix parameter. I think you mean "smtpd_use_tls" and it has been set properly. In fact, my mailserver is working perfectly on its own without Sendgrid. It is just that Sendgrid is complaining that unauthenticated senders are not allowed, while I am sending the correct login details. Somehow those login details are ignored because authentication is handled by Dovecot, at least that's what I expect. – ShakiFanatico Mar 19 '15 at 15:42
1

Unauthenticated senders not allowed coming from SendGrid explicitly means that you're not attempting to authenticate; since the error says in reply to MAIL FROM command, it means that after your EHLO, you're supposed to send an AUTH LOGIN, but you're instead going straight to MAIL FROM.

I see that you have the configuration from the SendGrid docs, so have you made sure to reboot PostFix after updating those settings?

jacobmovingfwd
  • 2,185
  • 14
  • 11