Blog

Setting up Sendgrid & Postfix on Vicibox 7

Initally I tried setting up the smtp settings using yast, but received this message when sending a test email from the command line.
 

"SASL authentication failed; cannot authenticate to server smtp.sendgrid.net [108.168.190.109] : no mechanism available."


The root cause of the error is that in order for postfix to authenticate with sendgrid it requires that cyrus-sasl package be installed. 

Install cyrus-sasl:

# zypper install postfix mailx cyrus-sasl


Create a Password File:

# nano /etc/postfix/sasl_passwd


Add the line:

[smtp.sendgrid.net]:587    username:password

Save and close the file.

Configure Postfix:

There are six parameters which must be set in the Postfix configuration file main.cf.

relayhost, which specifies the mail relay host and port number. The host name will be enclosed in brackets to specify that no MX lookup is required.

smtp_use_tls, which enables (or disables) transport layer security.

smtp_sasl_auth_enable, which enables (or disables) SASL authentication.

smtp_sasl_security_options, which in the following configuration will be set to empty, to ensure that no Gmail-incompatible security options are used.

smtp_sasl_password_maps, which specifies the password file to use. This file will be compiled and hashed by postmap in a later step.

smtp_tls_CAfile, which specifies the list of certificate authorities to use when verifying server identity.

# nano  /etc/postfix/main.cf


Add or modify the following values:

relayhost = [smtp.sendgrid.net]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_tls_CAfile = /etc/ssl/ca-bundle.pem

Save and close the file.


Edit the master config.

# nano  /etc/postfix/master.cf


Uncomment (delete the pound sign) from the line which reads:

#tlsmgr unix - - n 1000? 1 tlsmg

Save and close the file.

Compile and hash the password file:

# sudo postmap /etc/postfix/sasl_passwd


Restart Postfix:

# sudo service postfix restart


Send a test email:

# echo "Subject: postfix test" | sendmail -v [email protected]


A mail delivery status report will be sent to <root>.

To view report:

# nano /var/mail/root

 


Add Comment