On Wed, 20 May 2009, none none wrote:

> We are running postfix 2.3.3. on a Redhat ES 5.1
> We are receiving mail for two domains:
> a) domain.com
> b) customers.domain.com
> 
> Recently a company that we cooperate with, asked us to 
> forward all the e-mails sent to them (for "security" reasons) 
> from domain.com to an 
> alternative SMTP (othersmtp.company.com) that is 
> other than the company's primary MX.

So company.com wants emails from sen...@domain.com -> any...@company.com to
be routed to othersmtp.company.com, but mail from all other domains should
go to the primary MX.

> We implemented this, by modifying the /etc/postfix/transport file, 
> and it worked like a charm.

You did not provide a specific example from your transport file, but
presumably, you modified it so *all* mail destined for any...@company.com is
routed to othersmtp.company.com.  But your requirements are to route mail to
othersmtp.company.com *only* when sen...@domain.com -> any...@company.com.

> The problem is that we would like to override the above rule for the domain
> customers.domain.com. So when someone from customers.domain.com sends
> e-mail to company.com that mail is sent to the company's primary MX and not
> via othersmtp.company.com.

By default, Postfix will try to send all mail to company.com via its primary
MX, so the "override" is needed *only* when mail is going to company.com
from a sender in domain.com.  You can run a second instance of Postfix that
routes all mail for company.com to othersmtp.company.com.  On the initial
(your current) instance of Postfix, use sender_dependent_relayhost_maps to
route all mail from send...@domain.com to the second instance.  There, mail
for company.com will be forced towards othersmtp.company.com, while mail to
other recipients will be routed normally.

You may want to consider and mitigate any unintended consequences, and I
realize this seems like overkill for what you want to do, but I cannot think
of another way to do it.

-- 
Sahil Tandon <sa...@tandon.net>

Reply via email to