Friday, October 18, 2019

Installing MAILJET to Ubuntu 18.04 using POSTFIX (to send email using smtp mail relay)

MailJet is a Third Party email sending (SMTP mail relay).  Mailjet allow you to send up to 200 emails per day for Free (no strings attached!).

Go to mailjet to sign-up here:   https://www.mailjet.com

This guide will quickly show you all the commands to integrate MailJet to your Ubuntu 18.04 Server using POSTFIX.


INSTALLING POSTFIX MODULES AND SASL PASSWORD

sudo apt install postfix libsasl2-modules


SETUP POSTFIX's MAIN.CF CONFIGURATION FILE

sudo nano /etc/postfix/main.cf


# outbound relay configurationsrelayhost = in-v3.mailjet.com:587smtp_sasl_auth_enable = yessmtp_sasl_password_maps = hash:/etc/postfix/sasl_passwdsmtp_sasl_security_options = noanonymoussmtp_tls_security_level = mayheader_size_limit = 4096000

NOTE: your relayhost value may be different, please double check with your MailJet account.


SETUP POSTFIX's SASL_PASSWD FILE 
(get your api-key and secret-key from your MailJet account)

sudo nano /etc/postfix/sasl_passwd

in-v3.mailjet.com:587  api-key:secret-key

sudo postmap /etc/postfix/sasl_passwd
sudo chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo systemctl restart postfix


CONFIGURE YOUR SENDER ADDRESS -or- DOMAIN AUTHENTICATION
(this is VERY IMPORTANT for your email deliverability)

Go to your MailJet account and find Sender Email Address
Go to your MailJet account and find Domain Authentication


TEST SENDING EMAIL AND CHECK YOUR SCORE!

sudo apt install bsd-mailx


echo "this is a test email." | mailx -r from-address -s "Hello sending from MailJet" to-address


No comments:

Post a Comment