User Tools

Site Tools


sysadmin:linux:email_forward

Configuring Postfix for Sparkpost

NOTE: Before doing anything, make sure you have set the full qualified domain name of your server (AWS will not do this for you)

  • hostnamectl set-hostname <name>.<domain>

Install the tools you will need

  • apt install postfix mailutils
  • cp /usr/share/postfix/main.cf.debian /etc/postfix/main.cf
  • systemctl enable postfix
  • systemctl start postfix
  • cd /etc/postfix
  • edit main.cf and change the parameter my-origin and change it to the following: my-origin = <domain>
  • Add the following to the end
myhostname=<host>.<domain>
mydomain=<domain>
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:SMTP_Injection:<hash string>
relayhost = [smtp.sparkpostmail.com]:587
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000

Go to the Sparkpost Console

  • Add a domain
  • Enter the information and note the DKIM record
  • Add that record to your DNS (on AWS/Route 53 add as a TXT)
  • In Sparkpost, verify that the DKIM record is correct

From your host

  • echo “Test mail from New Ubuntu Server” | mail -s “Test Email” <email address>
sysadmin/linux/email_forward.txt · Last modified: by mlivolsi