Need help with Postfix / MX record setup: Email forwarding not working

Posted April 30, 2015 17.4k views

I’m trying to setup my server so that emails get forwarded to users personal email accounts. I don’t want to have to manage email on the server. I setup my Ubuntu server with serverpilot and cloudflare and it is running Wordpress just fine right now, but just the emails are not coming through. Here is my setup:

  1. MX records at CloudFlare

MX mail handled by 1 Automatic

  1. my postfix config file:

/etc/postfix/ (See below)

  1. my /etc/aliases file with mappings, like this one:

info: [my username]

Am I missing something, or did I configure something wrong? Thanks for your help!


# See /usr/share/postfix/ for a commented, more complete version

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname =
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost
relayhost =
mynetworks = [::ffff:]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all
local_transport = error:local delivery is disabled

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

I discovered that to do it the way I was trying would have required poking a hole in the firewall set up by ServerPilot, they recommend to instead point your MX records at an external email provider. The ones they list all charge a fee, but if you just want forwarding and don’t have too big a demand, you can get a free account at Mailgun. Here is a post on how to set up Mailgun with Digital Ocean. This worked for me.

Sorry I can’t help you with your config but this tool has provided me with good insights when I was looking for mistakes in my own config:

A quick test shows that your hostname is
Don’t know if that’s relevant for your postfix config since I never used cloudflare or any other CDN before but it might be worth a shot.