Updated: 28 September 2026 · Applies to: Postfix 3.8 (Ubuntu 24.04) and 3.10 (Ubuntu 26.04)
By default Postfix connects to other mail servers from the server's main IP address and introduces itself with the server's host name. On a dedicated server with several addresses you usually want more control: a chosen address for the mail, and a HELO name that matches that address. This guide sets up one extra sending address in Postfix, and the next guide shows how to give several domains their own addresses.
Why the address and the name must match
When Postfix connects it says "HELO name". Receivers compare that name with the reverse DNS of the address they see, and with the forward DNS of the name. If all three agree (address, PTR name, HELO name), the connection looks like it comes from a properly set up server. Gmail asks for valid forward and reverse DNS records, and Yahoo asks for meaningful, non-generic PTR records.
Before you start
- The extra address is configured and reaches the internet from that address (How to test that every additional IP address works on your server?, step 4, and How to check that outgoing port 25 works from your dedicated server?).
- The address has reverse DNS
mail2.example.comand an A record frommail2.example.comto it (How to set reverse DNS (PTR) for many IP addresses and check forward-confirmed rDNS?). - Postfix works (How to install and configure Postfix for sending on Ubuntu?).
1. Create a separate delivery service for this address
Postfix delivers mail through "transports", defined in /etc/postfix/master.cf. Add a new one at the end of the file. It is a copy of the normal smtp client with two options:
out2 unix - - y - - smtp -o smtp_bind_address=203.0.113.12 -o smtp_helo_name=mail2.example.com -o smtp_bind_address_enforce=yes
out2is the name of the transport. Use simple names (letters and digits).smtp_bind_addressmakes this service connect from that IPv4 address.smtp_helo_nameis the HELO/EHLO name it sends.smtp_bind_address_enforce=yes(Postfix 3.7 and later) defers the mail if the address cannot be used, instead of silently sending from another address.
If your server also has IPv6, mail may be sent over IPv6 with another source address. Either set smtp_bind_address6 as well or disable IPv6 delivery for this transport with -o inet_protocols=ipv4.
2. Use it
To send all mail through this transport, set it as the default:
sudo postconf -e "default_transport = out2" sudo systemctl reload postfix
To use it only for some domains or customers, see How to give each domain or customer its own sending IP address in Postfix?.
3. Test
echo "bind test" | mail -s "Bind test" -a "From: test@example.com" yourname@gmail.com sudo journalctl -t postfix/out2 --since "5 minutes ago"
Open the message at the receiver and check the "Received" header of the first hop: it must show mail2.example.com and the address 203.0.113.12. In Gmail use "Show original" and read the line Received: from mail2.example.com (mail2.example.com [203.0.113.12]).
Common problems
- Mail is deferred with "Cannot assign requested address": the address is not configured on the server.
- The receiver shows the main address: the message did not use the new transport; check
default_transportor the sender-dependent map. - Connection times out from the extra address: the address is not routed for outgoing traffic (How to test that every additional IP address works on your server?).
- Receivers complain about the HELO name: the name has no A record, or the PTR record names something else.
Frequently asked questions
Can I use several addresses for one domain?
Technically yes, but a stable reputation builds up faster when one kind of mail always leaves from the same address. See How to give each domain or customer its own sending IP address in Postfix?.
Do I need a separate Postfix instance for each address?
No. One instance with several transports is enough.
Source: Postfix configuration parameters (smtp_bind_address, smtp_helo_name).
Need a dedicated server, more IP addresses, or a hand with the setup?
- Unmanaged dedicated servers: full root access and IPv4 subnets from /29 up to /24, ordered with the server or added later.
- Managed dedicated servers: our team looks after the operating system, updates, security and monitoring.
- Dedicated server locations: choose the country and data centre when you order.
Prefer a hand with the setup? Our engineers can do it for you: Hire an Expert, or use our on-demand server management.
