Hello,

You will need to modify it where I am extracting the username part of the email 
address from the To: address.  That is
where you will want to examine the From: address instead.  Note that I am 
altering the subject to insert the original
username in front of the subject so that messages in the bigbrother account can 
be sorted by their original recipients.
 Note that this recipe will need to be in /etc/procmailrc so that it is 
processed for all incoming messages.

Hope this helps.


SHELL=/bin/sh
LOGFILE=/var/log/procmail.log
TODAY=`date +%Y-%m-%d`
#VERBOSE=yes

# forward a copy of all incoming messages
:0
* [EMAIL PROTECTED]
* ! ^X-Loop: mynosydomain\.com
{
# extract subject
  SUBJECT=`formail -cxSubject:`
# get the To: address without comments
  :0h:
  CLEANTO=|formail -cxTo:
  # username portion
  :0:
  * CLEANTO ?? ^\/[EMAIL PROTECTED]
  {
    TO_USER=$MATCH
  }
# insert X-Loop header
  :0fwh:
  | formail -A "X-Loop: mynosydomain.com"
# deliver the original
  :0c:
  ${DEFAULT}
# alter the subject
  :0fw:
  | formail -i "Subject: [$TO_USER] $SUBJECT"
# deliver the copy with the altered subject
  :0:
  ! [EMAIL PROTECTED]
}

Dale

Reply via email to