Posterous
Dave is using Posterous to post everything online. Shouldn't you?
Profile_thumb
 

Davezor’s Blog

« Back to blog

Getting exim4 to relay to non standard ports

I spent the last several days wrestling with exim4 on debian.  I know
nothing about SMTP servers, so I'm slowly and painfully learning how
to configure them.  I have a custom SMTP server I'm actively
developing, and I need a workflow that allows me to develop on a stage
server and then eventually push those changes to a live, production
server.  However, I only have one linode host to work with, and one IP
address.  So I chose to have my custom server running on
stage.example.com:2501 and the production server example.com:2500.
Then I had exim4 relay to the appropriate server based on the
recipient domain.

In  /etc/exim4/update-exim4.conf.conf file, make sure the following lines exist:

dc_local_domains='example.com'
dc_relay_domains='*.example.com;example.com'

Additionally, I needed to modify the remote_smtp transport
(/etc/exim4/conf.d/transport/30_exim4-config_remote_smtp). In the
"remote_smtp" section, immediately following "drive = smtp":

port = ${lookup{$domain}lsearch{/etc/exim4/domain_port_mapping}{$value}{25}}

Make sure you have the following in /etc/exim4/domain_port_mapping:

stage.example.com 2501
example.com 2500

One last addition is needed to make this work. We need to add a line
to the router that lets us know that it's okay to relay mail to
localhost. So, in /etc/exim4/conf.d/router/200_exim4-config_primary,
in the "dnslookup_relay_to_domains:" section, put this:

self = send

And that's it. As long as the servers are running on ports 2500 and
2501, this exim4 configuration will do what's necessary. Hooray for 5
days of pain!

Loading mentions Retweet
Nov 03, 2009
Daniel Freedman said...
Your five days of pain = better documentation for the rest of the world.
 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    Connect    twitter