IRedMail/FAQ/Send.out.email.from.specified.IP.address

From iRedMail
(Difference between revisions)
Jump to: navigation, search
 

Latest revision as of 07:49, 24 February 2014

If you have multiple IP addresses available on your iRedMail server, and you want to send out email from specified IP address for hosted mail domain 'example.com', please try below steps.

  • Parameter "sender_dependent_default_transport_maps" is available in Postfix 2.7 or later, so please make sure your Postfix version is 2.7 or later releases:
Terminal:
# postconf mail_version
mail_version = 2.10.3
  • Add Postfix setting: sender_dependent_default_transport_maps in /etc/postfix/main.cf. NOTE: I use pcre here, not regexp or hash.
File: /etc/postfix/main.cf
sender_dependent_default_transport_maps = pcre:/etc/postfix/sdd_transport.pcre
  • Add file /etc/postfix/sdd_transport.pcre. NOTE: I use domain 'example.com' for testing, it will use transport 'smtp-example-com'.
File: /etc/postfix/sdd_transport.pcre
/@example\.com$/ smtp-example-com:
  • Add custom transport in Postfix /etc/postfix/master.cf:
File: /etc/postfix/master.cf
smtp-example-com  unix -       -       n       -       -       smtp
   -o smtp_bind_address=172.16.244.159
   -o smtp_helo_name=example.com
   -o syslog_name=postfix-example-com

NOTE: We use IP address 172.16.244.159 here for example. You must have the IP address specified here available on your server.

  • Restart Postfix service.

Now try sending email to Gmail/Yahoo/Hotmail as user 'xxx@example.com', you can see syslog name 'postfix-example-com' in Postfix log file.

Personal tools