OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: [OT] Saving outgoing email Gmail style

From: mouss (mlist.onlyfree.fr)
Date: Wed Jan 16 2008 - 05:44:01 CST


Mihira Fernando wrote:
> With Gmail, when you send email using their smtp server, a copy of the mail
> gets saved in the 'Sent' folder in the Gmail web interface.
> Does anyone know how this is done ? OR how to achieve the same result using
> Postfix ?
> My goal is to setup email backups with a web interface for my virtual mailbox
> users so that they can get a copy of their mail both received and sent in
> their Inbox and sent folders respectively.

The following is untested. risk at your own use.

always_bcc = bccbcc.example.com

in transport maps:
bcc.example.com copy2sent:

in master.cf, define a copy2sent transport to deliver to the Sent folder
of ${sender} (instead of the usual delivery to ${recipient}). for example:

copy2sent - n n - - pipe
         flags=... user=...
     flags=... user=... argv=/path/to/maildrop
         -d ${sender} folder=Sent

and in maildroprc, pickup the folder=Sent argument and append it to
${DEFAULT}.

If ${sender} doesn't match your setup (for example, if users are stored
without the domain part), use a wrapper script.

Note that this must be done for submitted mail, with SASL AUTH and
sender login match. mail to bcc.example.com must not be accepted
otherwise.