procmail
[Top] [All Lists]

archiving sent mail

2009-10-13 21:00:29
I've been doing a little reading on this, and am aware that procmail
filters incoming, not outgoing, mail.  There are suggestions that
somehow use postfix's sender_bcc_maps to send a bcc of all outgoing
mail to an address that can be used to archive.  I have successfully
made the postfix adjustments to do this, I think, but having
trouble getting procmail to handle the bcc mails.

At present I'm archiving incoming emails by month:

DATE=`date '+%y%m'`
:0c:
| gzip -fc9 >> $HOME/mbox_$DATE.gz

I'd like to do similar with the sent mail.  I have set up postfix to
create a bcc mail of all mail originating from our domain name to
archiver(_at_)our(_dot_)domain(_dot_)name

I was going to use something like this to archive them similar to
the incoming one above:

DATE=`date '+%y%m'`
:0
* ^TO_(_dot_)*archiver(_at_)our\(_dot_)domain\(_dot_)name
{
  FROM_USERNAME=`formail -rt -xTo: \
       | sed -e 's/[;\`\\]/ /g' \
       | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g' \
       | cut -f 1 -d @`

  :0c
  | gzip -fc9 >> /home/${FROM_USERNAME}/Sent_${DATE}.gz
}

The mails do arrive in archiver's mbox, but they're not getting
copied to the sender's $HOME/Sent_0910.gz file.

Any ideas?  Initially I thought it might be the TO_ macro doesn't
handle BCC, but reading man procmailrc I think it does.

-- 
Troy Piggins
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)de
http://mailman.rwth-aachen.de/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>