On Sat, Dec 12, 2009 at 03:37:17PM +0000, Kārlis Repsons wrote: > Could anyone help me sorting this out: its very convenient to store > mails on mailserver and relay sent mail through it, so it gets sent > immediately, but there is a problem: how can relayed sent mail be > also saved on mailserver, using the same LDA program as for > incoming mail (to place it into the right folder where also > incoming mail is)? Is that possible?
This is generally best handled at the MUA/IMAP level, where a MUA uses a "sent" IMAP folder to store mail. You could consider a combination of PCRE sender_bcc_maps with recipient_delimiter: /(.*)(\+.*)?(\...@your\.domain)$/ $1+sent$3 so u...@your.domain or user+someextens...@your.domain as sender is BCCed to user+s...@your.domain . (You would of course want your LDA to deliver these to a special folder. This is a simple matter to manage with either of the Postfix delivery agents, local(8) or virtual(8).) There are many problems with a MTA-based approach such as this. Consider this email for example. "GMX.co.uk" is not my domain, but I set this address as my sender address. This mail would not have been archived without a much more complex (read: won't scale well) lookup for sender_bcc_maps. One user might have numerous legitimate sender addresses to use. Oh, you said you want the copies delivered to the same mail folder. That's a little simpler, but still might not be what you really are after. I think the bottom line is that you're trying to make a MTA do things it was not meant to do. -- Offlist mail to this address is discarded unless "/dev/rob0" or "not-spam" is in Subject: header