title: Postfix authentication with Dovecot and integrating Sendgrid
body: <p>I currently have a working mailserver with Postfix and Dovecot with virtual mailboxes in mySQL. However, I have a problem setting Sendgrid as relayhost.</p>
  
  <p>As said, the authentication is done as follows:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>I also use TLS and the certificates are pointed to correctly.</p>
  
  <p>Now, when I follow Sendgrid's guide:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>(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: </p>
  
  <blockquote>
    <p>"550 Cannot    receive from specified address :
    Unauthenticated senders    not allowed (in reply to MAIL FROM
    command)"</p>
  </blockquote>
  
  <p>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.</p>
  
  <p>Any thoughts?</p>