Here's my code to do exactly this, with some additional features:
- The prefix "xx" is required, so this will file mail to
xxwhatever(_at_)myudomain(_dot_)com to mailbox whatever. (The variable part of
the name must be all letters, numbers, underscore, dash or dot.)
- it checks the mailbox name against a list of addresses I no longer
want to receive mail from (eg, ecommerce sites after I've gotten my
receipt) and dumps it;
- it checks the mailbox against a list of those for which I should not
receive any mail that does not contain the address in the To or CC
fields (ie, if a spammer Bcc's my ebay address, it will be filed to
/dev/null rather than the ebay mailbox).
- it adds a header to the mail allowing client-side filtering
You don't need formail to retrieve the list, you can do that with the
#MATCH variable although you'll need some form of prefix. I've had
little luck getting the \/ to work at the beginning of a pattern.
Good luck.
ken
:0
* xx\/[^\(_dot_)]*(_at_)mydomain\(_dot_)com
{
:0 iw
LISTNAME=|echo $MATCH | perl -pe 's/^([a-z0-9_\.-]*)@.*$/$1/i'
:0
* $ LISTNAME ?? ${DUMP}
/dev/null
:0:
* ! $ ^TO.*${LISTNAME}
* $ LISTNAME ?? ${NO_ANON}
spam-suspected
:0 f
| formail -a "X-Filter-ID: Filtered/$LISTNAME"
:0:
$LISTNAME
}
On Sat, 3 Feb 2001, Fiona Whelan wrote:
Hello,
I am new to this list and was hoping that someone might be able to help me.
I have a Linux shell account and all mail for my subdomain goes to my user
account.. so it
doesn't matter what username is used, I will receive it. I already use this
with procmail for
having automatic-response addresses, etc but what I want to do is this:
extract the username from To: header into the variable $TOUSER, copy the mail
to the folder
/home/fiona/Mail/$TOUSER, and then pipe the mail into my shell script
whattodo.sh.
I reckon I need to be using formmail to do the extraction bit, but am not too
familar with it.
Can anyone help out?
Thanks in advance,
__
|_
| I O N A
_____________________________________
Get your free E-mail at http://www.ireland.com
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail