2

I'm handling email for many different companies. Each company needs me to route all outbound email through a specific SMTP relay based on From address.

What software configuration or technology allows me to do this?

We are a Windows shop with Exchange 2010, but are open to other options like sendmail, or even buying or finding someone to build a custom Transport Agent

4 Answers 4

2

Assuming your Exchange machine forwards all email to another that runs sendmail, you can decide to route based on sender domain by using the $&f macro in rule set 0.

LOCAL_RULE_0
# first make sure that local mail gets delivered properly
R$-        $@OK
R$* < @ $=w . > $*        $@OK
# now deal with senders
R$*        $: $>canonify $&f $| $1
# stuff [email protected] sends goes through server1.relay
Ruser1 < @ domain1.com. > $* $| $* < @ $* . > $*         $#esmtp $@ [server1.relay] $: $2 < @ $3 . > $4
# stuff [email protected] sends goes through server2.relay
Ruser2 < @ domain2.com. > $* $| $* < @ $* . > $*         $#esmtp $@ [server2.relay] $: $2 < @ $3 . > $4
# stuff users from domain3.com send goes through server3.relay
R$* < @ domain3.com. > $* $| $* < @ $* . > $*        $#esmtp $@ [server3.relay] $: $3 < @ $4 . > $5

The above rule should be added to your /etc/mail/sendmail.mc. Next you should build your sendmail.cf and restart sendmail. Assuming you are on a Debian or Ubuntu system, this is done by issuing sendmailconfig. Keep in mind that in the above example the left and right hand sides of the rules are separated by tabs and not spaces, so you must type and not copy-paste the rule set.

1

Well, I'm biased towards (and familiar with) Linux with Postfix for front-line MTA work, so here's a solution with that:

Sender-dependent transport maps

   domain transport:nexthop
          Deliver  mail  for domain through transport to next-hop.
0

If you want to do this with Linux/sendmail, I think you'd need to setup a smart table. Details are available here.

0

Look at this: https://groups.gogle.com/forum/#!topic/comp.mail.sendmail/UQ5_TeaGd_c "Use LOCAL_RULE_0 insted of LOCAL_NET_CONFIG in smarttable.m4 to make smarrtable route message even for local recipients." After that all works

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .