Fabio Sangiovanni | 9 Feb 19:12
Picon
Favicon

Redirect all mail to one user retaining original envelope rcpt

Hi,

I need to configure Postfix to get the following result: I need every mail submitted by users to be
redirected to a remote account (via SMTP or LMTP), and every message must contain an header with the
original envelope rcpt.
Example:

user MUA submits 2 messages, one for aaa <at> domain1.com and the other for bbb <at> domain2.com; I need this two
messages NOT to be delivered to their respective recipients, but to another inbox, let's say
final_inbox <at> domain3.com, using SMTP or LMTP as delivery agent. Once in the inbox, I need to be able to get
the original envelope recipients (aaa <at> domain1.com and bbb <at> domain2.com) in some kind of headers.

I successfully managed to get this result with local delivery (X-Original-To: header), but I couldn't
find a way to keep the same information with smtp; it appears only in the Received: header, while I'd like to
have a dedicated one, if possible.

Is there a way I can get this kind of setup?

Thanks for your help!
Wietse Venema | 9 Feb 19:31

Re: Redirect all mail to one user retaining original envelope rcpt

Fabio Sangiovanni:
> Hi,
> 
> I need to configure Postfix to get the following result: I need
> every mail submitted by users to be redirected to a remote account
> (via SMTP or LMTP), and every message must contain an header with
> the original envelope rcpt.  Example:

/etc/postfix/main.cf
    smtpd_recipient_restrictions = 
	check_recipient_access pcre:/etc/postfix/prepend.pcre
	...stuff...
	reject_unauth_destination
	...more stuff...

/etc/postfix/prepend.pcre:
    /(.+)/ prepend X-Recipient: $1

	Wietse

Fabio Sangiovanni | 10 Feb 09:36
Picon
Favicon

Re: Redirect all mail to one user retaining original envelope rcpt

Hi Wietse,

thanks a lot for your help.
One last question: in order to redirect mail from the original recipient(s) to the catch-all address I'm
using address rewriting with canonical maps. Is this the best way to do it? Or should I rely on virtual
aliasing for some reason?
My configuration:

/etc/postfix/main.cf
	...
	recipient_canonical_classes = envelope_recipient
	recipient_canonical_maps = regexp:/etc/postfix/recipient_canonical
	…

/etc/postfix/recipient_canonical
	/.+@.+/	my_catch_all_address <at> mydomain.tld

Thanks again,
Fabio

Il giorno 09/feb/2012, alle ore 19:31, Wietse Venema ha scritto:

> Fabio Sangiovanni:
>> Hi,
>> 
>> I need to configure Postfix to get the following result: I need
>> every mail submitted by users to be redirected to a remote account
>> (via SMTP or LMTP), and every message must contain an header with
>> the original envelope rcpt.  Example:
> 
(Continue reading)

Noel Jones | 10 Feb 17:44

Re: Redirect all mail to one user retaining original envelope rcpt

On 2/10/2012 2:36 AM, Fabio Sangiovanni wrote:
> Hi Wietse,
> 
> thanks a lot for your help.
> One last question: in order to redirect mail from the original recipient(s) to the catch-all address I'm
using address rewriting with canonical maps. Is this the best way to do it? Or should I rely on virtual
aliasing for some reason?
> My configuration:
> 

If you want the envelop AND headers rewritten, use canonical_maps;
if you want only the envelope rewritten, use virtual_alias_maps.

  -- Noel Jones

Fabio Sangiovanni | 10 Feb 17:57
Picon
Favicon

Re: Redirect all mail to one user retaining original envelope rcpt

Hi Noel,

thanks, I'll follow your advice.

Fabio

Il giorno 10/feb/2012, alle ore 17:44, Noel Jones ha scritto:

> On 2/10/2012 2:36 AM, Fabio Sangiovanni wrote:
>> Hi Wietse,
>> 
>> thanks a lot for your help.
>> One last question: in order to redirect mail from the original recipient(s) to the catch-all address I'm
using address rewriting with canonical maps. Is this the best way to do it? Or should I rely on virtual
aliasing for some reason?
>> My configuration:
>> 
> 
> 
> If you want the envelop AND headers rewritten, use canonical_maps;
> if you want only the envelope rewritten, use virtual_alias_maps.
> 
> 
> 
>  -- Noel Jones
> 

Noel Jones | 10 Feb 17:44

Re: Redirect all mail to one user retaining original envelope rcpt

On 2/10/2012 2:36 AM, Fabio Sangiovanni wrote:
> Hi Wietse,
> 
> thanks a lot for your help.
> One last question: in order to redirect mail from the original recipient(s) to the catch-all address I'm
using address rewriting with canonical maps. Is this the best way to do it? Or should I rely on virtual
aliasing for some reason?
> My configuration:
> 

If you want the envelop AND headers rewritten, use canonical_maps;
if you want only the envelope rewritten, use virtual_alias_maps.

  -- Noel Jones


Gmane