2016-05-19 06:51:20 -05:00
<!DOCTYPE html>
2015-03-10 07:00:51 -06:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > Send out email from specified IP address< / title >
2015-07-31 23:14:52 -05:00
< link rel = "stylesheet" type = "text/css" href = "./css/markdown.css" / >
2015-03-10 07:00:51 -06:00
< / head >
< body >
2019-07-13 06:21:55 -05:00
2015-03-10 07:00:51 -06:00
< div id = "navigation" >
2017-11-16 21:48:44 -06:00
< a href = "https://www.iredmail.org" target = "_blank" >
2016-04-19 12:48:51 -05:00
< img alt = "iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>
< span > iRedMail< / span >
< / a >
2016-02-29 02:15:19 -06:00
// < a href = "./index.html" > Document Index< / a > < / div > < h1 id = "send-out-email-from-specified-ip-address" > Send out email from specified IP address< / h1 >
2015-06-09 09:26:03 -05:00
< p > If you have multiple IP addresses available on your iRedMail server, and would
like to send from different IP Addresses for different domains, follow the
steps below.< / p >
2015-03-10 07:00:51 -06:00
< h3 id = "requirement" > Requirement< / h3 >
2015-06-09 09:26:03 -05:00
< p > This can only be set up on Postfix version < code > > =2.7.x< / code > , because the parameter we
need < code > sender_dependent_default_transport_maps< / code > is available in Postfix-2.7 and
later releases.< / p >
2015-03-10 07:00:51 -06:00
< p > To check your Postfix version run:< / p >
< pre > < code > # postconf mail_version
< / code > < / pre >
< p > Which would return something like: < code > mail_version = 2.10.3< / code > < / p >
< h3 id = "steps" > Steps< / h3 >
< ul >
2015-06-09 09:26:03 -05:00
< li > Add Postfix setting < code > sender_dependent_default_transport_maps< / code > to the end of
< code > /etc/postfix/main.cf< / code > like below:< / li >
2015-03-10 07:00:51 -06:00
< / ul >
< pre > < code > sender_dependent_default_transport_maps = pcre:/etc/postfix/sdd_transport.pcre
< / code > < / pre >
< ul >
2015-06-09 09:26:03 -05:00
< li > Add file < code > /etc/postfix/sdd_transport.pcre< / code > with below content. NOTE: we use
domain < code > example.com< / code > for example, it will use transport < code > sample-smtp< / code > - see
examples.< / li >
2015-03-10 07:00:51 -06:00
< / ul >
< pre > < code > /@example\.com$/ sample-smtp:
< / code > < / pre >
< ul >
2015-06-09 09:26:03 -05:00
< li > Create new outgoing SMTP transports in < code > /etc/postfix/master.cf< / code > like below.
Note: you must replace our sample IP address < code > 172.16.244.159< / code > with your IP
address. If you want to use IPv6 address, please use < code > smtp_bind_address6< / code >
instead of < code > smtp_bind_address< / code > below.< / li >
2015-03-10 07:00:51 -06:00
< / ul >
< pre > < code > sample-smtp unix - - n - - smtp
-o smtp_bind_address=172.16.244.159
# -o smtp_helo_name=example.com
# -o syslog_name=postfix-example-com
< / code > < / pre >
< p > Option < code > smtp_helo_name< / code > and < code > syslog_name< / code > are optional.< / p >
2015-06-09 09:26:03 -05:00
< p > After this restart the Postfix service to apply your changes:< / p >
2015-03-10 07:00:51 -06:00
< pre > < code > # /etc/init.d/postfix restart
< / code > < / pre >
2015-06-09 09:26:03 -05:00
< p > Note: any unmatched domains will continue using the server's primary IP address
2016-05-19 06:51:20 -05:00
just as before.< / p > < div class = "footer" >
2019-12-31 00:07:48 -06:00
< p style = "text-align: center; color: grey;" > All documents are available in < a href = "https://github.com/iredmail/docs/" > GitHub repository< / a > , and published under < a href = "http://creativecommons.org/licenses/by-nd/3.0/us/" target = "_blank" > Creative Commons< / a > license. You can < a href = "https://github.com/iredmail/docs/archive/master.zip" > download the latest version< / a > for offline reading. If you found something wrong, please do < a href = "https://www.iredmail.org/contact.html" > contact us< / a > to fix it.< / p >
2016-05-19 06:51:20 -05:00
< / div >
2017-11-05 02:33:58 -06:00
<!-- Global site tag (gtag.js) - Google Analytics -->
< script async src = "https://www.googletagmanager.com/gtag/js?id=UA-3293801-21" > < / script >
< script >
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
2015-03-10 07:00:51 -06:00
2017-11-05 02:33:58 -06:00
gtag('config', 'UA-3293801-21');
2015-03-10 07:00:51 -06:00
< / script >
< / body > < / html >