From: Clayton Keller on
I have been looking through archives and through the man pages and
thought I'd go ahead and post my question.

My situation is this:

I need to deliver mail coming in addressed to a specific domain to two
separate transports. There are no mailboxes local to the server at all.
However, I did not think it was possible to configure two separate
transports in this manner. Our server is acting as a scanning gateway
and passes the message on after performing this task.

I then began to look at possibly using recipient_bcc_maps. My question
though is that if I am needing to deliver the same address to two
individual external systems, wouldn't I still need to define a 2nd
transport to get messages to the 2nd server. Would I need to rewrite the
domain on the bcc and setup a 2nd MX for the rewritten domain?

The end goal is to have messages coming in to any address @mydomain.com
delivered to server1 and server2 with the original address intact after
processing.

Any thoughts on ways to handle this would be appreciated.

Clay

From: Noel Jones on
On 3/4/2010 1:26 PM, Clayton Keller wrote:
> I have been looking through archives and through the man pages and
> thought I'd go ahead and post my question.
>
> My situation is this:
>
> I need to deliver mail coming in addressed to a specific domain to two
> separate transports. There are no mailboxes local to the server at all.
> However, I did not think it was possible to configure two separate
> transports in this manner. Our server is acting as a scanning gateway
> and passes the message on after performing this task.
>
> I then began to look at possibly using recipient_bcc_maps. My question
> though is that if I am needing to deliver the same address to two
> individual external systems, wouldn't I still need to define a 2nd
> transport to get messages to the 2nd server. Would I need to rewrite the
> domain on the bcc and setup a 2nd MX for the rewritten domain?
>
> The end goal is to have messages coming in to any address @mydomain.com
> delivered to server1 and server2 with the original address intact after
> processing.
>
> Any thoughts on ways to handle this would be appreciated.
>
> Clay
>

To deliver to two destinations, you need two recipients.

You can use a regexp recipient_bcc_maps to add another
recipient, then use smtp_generic_maps to rewrite it back to
the original during delivery. Use a transport_maps entry to
direct the bcc'ed mail to the proper server.

# main.cf
recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc
smtp_generic_maps = hash:/etc/postfix/smtp_generic
transport_maps = hash:/etc/postfix/transport

# recipient_bcc
if /@example\.com/
/^.*@example\.com$/ $1(a)new.example.com
endif

# smtp_generic
@new.example.com @example.com

# transport
new.example.com smtp:new.server.example.com

Be sure to postmap the hash: tables after making changes to them.

-- Noel Jones

From: Clayton Keller on
On 3/4/2010 3:54 PM, Noel Jones wrote:
> On 3/4/2010 1:26 PM, Clayton Keller wrote:
>> I have been looking through archives and through the man pages and
>> thought I'd go ahead and post my question.
>>
>> My situation is this:
>>
>> I need to deliver mail coming in addressed to a specific domain to two
>> separate transports. There are no mailboxes local to the server at all.
>> However, I did not think it was possible to configure two separate
>> transports in this manner. Our server is acting as a scanning gateway
>> and passes the message on after performing this task.
>>
>> I then began to look at possibly using recipient_bcc_maps. My question
>> though is that if I am needing to deliver the same address to two
>> individual external systems, wouldn't I still need to define a 2nd
>> transport to get messages to the 2nd server. Would I need to rewrite the
>> domain on the bcc and setup a 2nd MX for the rewritten domain?
>>
>> The end goal is to have messages coming in to any address @mydomain.com
>> delivered to server1 and server2 with the original address intact after
>> processing.
>>
>> Any thoughts on ways to handle this would be appreciated.
>>
>> Clay
>>
>
> To deliver to two destinations, you need two recipients.
>
> You can use a regexp recipient_bcc_maps to add another recipient, then


> use smtp_generic_maps to rewrite it back to the original during
> delivery. Use a transport_maps entry to direct the bcc'ed mail to the
> proper server.
>
> # main.cf
> recipient_bcc_maps = regexp:/etc/postfix/recipient_bcc
> smtp_generic_maps = hash:/etc/postfix/smtp_generic
> transport_maps = hash:/etc/postfix/transport
>
> # recipient_bcc
> if /@example\.com/
> /^.*@example\.com$/ $1(a)new.example.com
> endif
>
> # smtp_generic
> @new.example.com @example.com
>
> # transport
> new.example.com smtp:new.server.example.com
>
> Be sure to postmap the hash: tables after making changes to them.
>
> -- Noel Jones
>

Noel,

Thank you.

That's the direction I was thinking, but the part that was eluding me
was the smtp_generic portion, I was looking for rewrite but had not
stumbled on that aspect you recommended just yet.

I will take these ideas and work my own tests out from them. Thanks again.