2015-03-10 07:00:51 -06:00
|
|
|
# Send out email from specified IP address
|
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
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.
|
2015-03-10 07:00:51 -06:00
|
|
|
|
|
|
|
### Requirement
|
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
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.
|
2015-03-10 07:00:51 -06:00
|
|
|
|
|
|
|
To check your Postfix version run:
|
2015-06-09 09:26:03 -05:00
|
|
|
|
2015-03-10 07:00:51 -06:00
|
|
|
```
|
|
|
|
# postconf mail_version
|
|
|
|
```
|
|
|
|
|
|
|
|
Which would return something like: `mail_version = 2.10.3`
|
|
|
|
|
|
|
|
### Steps
|
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
* Add Postfix setting `sender_dependent_default_transport_maps` to the end of
|
|
|
|
`/etc/postfix/main.cf` like below:
|
|
|
|
|
2015-03-10 07:00:51 -06:00
|
|
|
```
|
|
|
|
sender_dependent_default_transport_maps = pcre:/etc/postfix/sdd_transport.pcre
|
|
|
|
```
|
2019-06-06 02:36:43 -05:00
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
* 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.
|
2015-03-10 07:00:51 -06:00
|
|
|
|
|
|
|
```
|
|
|
|
/@example\.com$/ sample-smtp:
|
|
|
|
```
|
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
* 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.
|
2019-06-06 02:36:43 -05:00
|
|
|
|
2015-03-10 07:00:51 -06:00
|
|
|
```
|
|
|
|
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
|
|
|
|
```
|
|
|
|
|
|
|
|
Option `smtp_helo_name` and `syslog_name` are optional.
|
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
After this restart the Postfix service to apply your changes:
|
|
|
|
|
2015-03-10 07:00:51 -06:00
|
|
|
```
|
|
|
|
# /etc/init.d/postfix restart
|
|
|
|
```
|
2019-06-06 02:36:43 -05:00
|
|
|
|
2015-06-09 09:26:03 -05:00
|
|
|
Note: any unmatched domains will continue using the server's primary IP address
|
|
|
|
just as before.
|