Mention ipv6 support in howto/send.out.email.from.specified.ip.addresses.md.

This commit is contained in:
Zhang Huangbin 2015-06-09 22:26:03 +08:00
parent d64197a907
commit 4e59f5568f
2 changed files with 39 additions and 15 deletions

View File

@ -1,12 +1,17 @@
# Send out email from specified IP address
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.
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.
### Requirement
This can only be set up on Postfix version`>=2.7.x`, because the parameter we need `sender_dependent_default_transport_maps ` is available in Postfix-2.7 and later releases.
This can only be set up on Postfix version `>=2.7.x`, because the parameter we
need `sender_dependent_default_transport_maps` is available in Postfix-2.7 and
later releases.
To check your Postfix version run:
```
# postconf mail_version
```
@ -15,18 +20,25 @@ Which would return something like: `mail_version = 2.10.3`
### Steps
* Add Postfix setting `sender_dependent_default_transport_maps` to the end of `/etc/postfix/main.cf` like below:
* Add Postfix setting `sender_dependent_default_transport_maps` to the end of
`/etc/postfix/main.cf` like below:
```
sender_dependent_default_transport_maps = pcre:/etc/postfix/sdd_transport.pcre
```
* Add file `/etc/postfix/sdd_transport.pcre` with below content. NOTE: I use domain 'example.com' for testing, it will use transport 'sample-smtp' - see examples.
* Add file `/etc/postfix/sdd_transport.pcre` with below content. NOTE: we use
domain `example.com` for example, it will use transport `sample-smtp` - see
examples.
```
/@example\.com$/ sample-smtp:
```
* Create new outgoing SMTP transports in `/etc/postfix/master.cf` like below. Note: you must replace our sample IP address `172.16.244.159 ` with your IP address.
* Create new outgoing SMTP transports in `/etc/postfix/master.cf` like below.
Note: you must replace our sample IP address `172.16.244.159 ` with your IP
address. If you want to use IPv6 address, please use `smtp_bind_address6`
instead of `smtp_bind_address` below.
```
sample-smtp unix - - n - - smtp
@ -37,10 +49,11 @@ sample-smtp unix - - n - - smtp
Option `smtp_helo_name` and `syslog_name` are optional.
After this restart the Postfix Service to apply your changes,
After this restart the Postfix service to apply your changes:
```
# /etc/init.d/postfix restart
```
Note: any unmatched domains will continue using the server's primary IP address just as before.
Note: any unmatched domains will continue using the server's primary IP address
just as before.

View File

@ -11,9 +11,13 @@
// <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>
<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>
<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>
<h3 id="requirement">Requirement</h3>
<p>This can only be set up on Postfix version<code>&gt;=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>
<p>This can only be set up on Postfix version <code>&gt;=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>
<p>To check your Postfix version run:</p>
<pre><code># postconf mail_version
</code></pre>
@ -21,19 +25,25 @@
<p>Which would return something like: <code>mail_version = 2.10.3</code></p>
<h3 id="steps">Steps</h3>
<ul>
<li>Add Postfix setting <code>sender_dependent_default_transport_maps</code> to the end of <code>/etc/postfix/main.cf</code> like below:</li>
<li>Add Postfix setting <code>sender_dependent_default_transport_maps</code> to the end of
<code>/etc/postfix/main.cf</code> like below:</li>
</ul>
<pre><code>sender_dependent_default_transport_maps = pcre:/etc/postfix/sdd_transport.pcre
</code></pre>
<ul>
<li>Add file <code>/etc/postfix/sdd_transport.pcre</code> with below content. NOTE: I use domain 'example.com' for testing, it will use transport 'sample-smtp' - see examples.</li>
<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>
</ul>
<pre><code>/@example\.com$/ sample-smtp:
</code></pre>
<ul>
<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.</li>
<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>
</ul>
<pre><code>sample-smtp unix - - n - - smtp
-o smtp_bind_address=172.16.244.159
@ -42,11 +52,12 @@
</code></pre>
<p>Option <code>smtp_helo_name</code> and <code>syslog_name</code> are optional.</p>
<p>After this restart the Postfix Service to apply your changes,</p>
<p>After this restart the Postfix service to apply your changes:</p>
<pre><code># /etc/init.d/postfix restart
</code></pre>
<p>Note: any unmatched domains will continue using the server's primary IP address just as before.</p><p style="text-align: center; color: grey;">Document published under a <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">CC BY-ND 3.0</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
<p>Note: any unmatched domains will continue using the server's primary IP address
just as before.</p><p style="text-align: center; color: grey;">Document published under a <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">CC BY-ND 3.0</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)