Re: Re[2]: Incoming mail archiving with Postfix

2009-11-26 Thread Wietse Venema
Zohan:
> Wietse, thank you,
> 
> > Postfix local/pipe/virtual delivery agents record the delivered
> > to address in the Delivered-To: header

That is, the final recipient address after alias processing and
forwarding. All mail that is delivered to the same mailbox has the
same Delivered-To: address.

Postfix local/pipe/virtual delivery agents record the original
recipient in the X-Original-To: header. That is, the recipient
address before alias processing and forwarding.

You can embed the original recipient as an extension to the final
recipient address, if you must insist on using the Delivered-To:
header.

Using pcre-based recipient_bcc_maps:

/^(.+)@([...@]+)$/ archive+$1...@example.com

Wietse


Re[2]: Incoming mail archiving with Postfix

2009-11-26 Thread Zohan
Wietse, thank you,

> Postfix local/pipe/virtual delivery agents record the delivered
> to address in the Delivered-To: header

Then, in which way would you recommend to copy such a message to special 
arch...@mydomain mailbox, retaining Delivered-To: header? (and not replacing it 
with "arch...@mydomain", to allow further sorting) Is it possible to do it with 
Postfix? I guess this can be done with Dovecot LDA + Sieve, by storing 
Delivered-To: into some other header and redirecting message to archive 
mailbox, but that doesnt' seem to be very elegant. 


Re: Incoming mail archiving with Postfix

2009-11-26 Thread Wietse Venema
Zohan:
> Hi,
> 
> I need to archive all incoming mail for my virtual domains (by
> copying mail to dedicated archive mailbox) and then sort it
> according to address it has been delivered to.

Postfix local/pipe/virtual delivery agents record the delivered
to address in the Delivered-To: header.

> One major drawback of existing milter-based solutions, as well as
> of virtual aliasing and BCC maps, is that in some cases neither
> "To:" header nor envelope-to contain actual recipient address.

Postfix local/pipe/virtual delivery agents record the original
recipient address in the X-Original-To: header.

man 8 local
man 8 pipe
man 8 virtual

Wietse


Incoming mail archiving with Postfix

2009-11-26 Thread Zohan
Hi,

I need to archive all incoming mail for my virtual domains (by copying mail to 
dedicated archive mailbox) and then sort it according to address it has been 
delivered to.

One major drawback of existing milter-based solutions, as well as of virtual 
aliasing and BCC maps, is that in some cases neither "To:" header nor 
envelope-to contain actual recipient address. This can be the case of our local 
(virtual) address receiving forwarded mail from outside, or delivery address 
being result of address rewrite or alias expansion. In either case, we state 
that the actual delivery address is known only since the moment of virtual 
transport invocation (right?). In my case pipe(8) to Dovecot LDA is used as 
virtual transport.

The question is, how do I organize mail copying simultaneously with virtual 
transport invocation (delivery), and how do I pass actual delivery address to 
mail archival system? This can be some message header or "plus" address.

Thank you!
Zohan