Skip to content

Per-account outbound IP routing in cPanel

How to configure Exim on a cPanel server to route outbound mail through different IPs based on the sending cPanel user, so high-volume senders don't share reputation with the rest.

On a cPanel host with mixed workloads — some accounts send transactional only, some send newsletters, some are mostly inbound — sharing a single outbound IP averages everyone’s reputation together. Per-account outbound IP routing solves this. Each account can be bound to a specific IP, and Exim selects the IP per message based on the sending user. The configuration lives in Exim’s transport definitions and requires a small overhead in administration, but pays back in stable per-account reputation.

What’s happening

Exim’s smtp transport supports an interface option that specifies the source IP for outbound connections. cPanel exposes this at the domain level via WHM > Tweak Settings (account-wide settings), but for true per-account routing you write a custom transport that branches on the sending user. The router routes the message; the transport sends it from the chosen IP. Each account’s outbound IP is then independent.

How to verify

Confirm the server has multiple IPs available for outbound:

ip -4 addr show
hostname -I

Then inspect the current Exim transport configuration:

exim -bP transports | head -40

Look for the remote_smtp transport — that’s the default outbound. A per-account version of this transport is what we’ll add.

The fix

  1. Decide the IP-to-account mapping. Document it: account bigsender_cpanel -> IP 192.0.2.50, account marketing_cpanel -> IP 192.0.2.51, default -> IP 192.0.2.49.

  2. Add the secondary IPs to the server via WHM > IP Functions > Add a New IP. Confirm they bind on the network and that rDNS resolves correctly for each — outbound mail needs matching PTR.

  3. Add a custom Exim transport in /etc/exim.conf.local under @CONFIG. Example:

    per_user_smtp:
      driver = smtp
      interface = ${lookup{$authenticated_id}lsearch{/etc/exim_outbound_ips}{$value}{192.0.2.49}}
      helo_data = ${lookup{$interface_address}lsearch{/etc/exim_helo_map}{$value}{$primary_hostname}}

    Build /etc/exim_outbound_ips as account: ip pairs.

  4. Add a router that selects the transport based on the authenticated user. The router runs before the transport and tells Exim which to use.

  5. Restart Exim and confirm the mapping works by sending a test message from each account and reading the destination’s Received: chain for the expected IP.

  6. Publish SPF for each domain that includes the relevant IPs. The IP that sends must be authorized in SPF for the domain that appears in From:.

For environments where reputation-per-account matters and the operations work to maintain mappings is justified, Stack Harbor handles the per-account routing as part of environment management.