Linux – forward email to external domain (postfix)

How to forward an email to an external domain in postfix (linux):

Configure postfix like a normal mailserver. In the config you can use virtual_alias_maps to create a mapping table for the delivery of the emails.

In this file you can forward every email to the address user@MYDOMAIN.TLD to a other user from an external domain.

apt-get install postfix

-> configure as a internet site -> domainname: mail.MYDOMAIN.TLD


nano /etc/postfix/main.cf

 # change
 myhostname = MYDOMAIN.TLD
 mydestination = mail.MYDOMAIN.TLD, localhost.com, localhost

 # insert at the bottom of the file
 virtual_alias_domains = MYDOMAIN.TLD
 virtual_alias_maps = hash:/etc/postfix/virtual

nano /etc/postfix/virtual

 user@MYDOMAIN.TLD user@EXTERNALDOMAIN.TLD


postmap /etc/postfix/virtual

/etc/init.d/postfix restart

set the mx record of MYDOMAIN to mail.MYDOMAIN.TLD.
set the a record of the subdomain mail to the ip address of MYDOMAIN
set the ptr record from the ip address of MYDOMAIN to MYDOMAIN.TLD

Kommentar verfassen

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Nach oben scrollen