How to create domain forwarder for non existing emails?

November 4, 2016 902 views
Email CentOS


How to create domain forwarders for non existing emails on my virtual server?

I have postfix installed and configured. On top of my configuration file in /etc/postfix/ I have:

In my domain zone I have Gmail MX records automatically set, but I don't know what I miss or doing wrong. Any help?

3 Answers

If your domain has gmail MX records on it than emails sent to your domain would be sent to gmail's server (which would reject them if you dont have "Gmail for your domain" services).

You'll need to create MX records that point to your droplet. First create an A record for and point it to your droplet, next create the MX records for

If these changes once applied don't resolve the problem I would recommend sharing your full postfix configuration here and also checking the error logs in /var/log/ for any indications of a problem.

Running mail services can be a headache and if you only need a limited number of boxes or just want to forward to your gmail account you may want to look at which provides a free service for up to 20 (i believe) mail boxes for your domain. I use them for a couple of my own projects.

Hi Ryan,

Thanks for the reply.

I will test what you suggest and write back here.


Finally I sorted it you!

To create the sub-domain "" in your domain zone you need to add "mail" instead of the full sub-domain name and your droplet IP. When I did these changes the sub-domain start propagating and I was able to point the forwarder.

You will also need to unblock port 25 (SMTP) or to use alternative port like 2525 for the connection:

$ firewall-cmd --zone=public --add-port=25/tcp
$ firewall-cmd --zone=public --add-port=2525/tcp

Then reload the firewall:

$ firewall-cmd --reload

Test if the port work with telnet from your local computer terminal:

$ telnet 25

The result must look like mine below:

Trying Dropplet IP...
Connected to
Escape character is '^]'.
220 ESMTP Postfix

If the allowed ports work you can add them permanently with:

$ firewall-cmd --zone=public --permanent --add-port=25/tcp
$ firewall-cmd --zone=public --permanent --add-port=2525/tcp

The again reload the firewall:

$ firewall-cmd --reload

Once these changes are done the forwarder will start working.

In my /etc/postfix/ I added the lines below at the end of the file:

myhostname =
inetinterfaces = $myhostname, localhost
aliasdomains =
alias_maps = hash:/etc/postfix/virtual
mynetworks = [::ffff:]/104 [::1]/128

The final step was to include the forwarders in /etc/postfix/virtual somewhere at the end of the file:

When the changes are done restart postfix and your forwarders will start working as soon your is fully propagated usually shortly in about 10 minutes.

Have another answer? Share your knowledge.