procmail
[Top] [All Lists]

whitelist matching (was: How do I get the message body ???)

2002-08-13 05:40:39
My basic problem seems to be that while Dallman's solution to matching
from a white list (changed slightly in the light of some personal emails
not on the list)

FROM=`formail -x From:`
USERNAME_CHARACTERS="a-z0-9+._=-"
DOMAINNAME_CHARACTERS="a-z0-9.-"

:0:
* $ ^From:(.*\<)?\/[$USERNAME_CHARACTERS]+(_at_)[$DOMAINNAME_CHARACTERS]+
* $ ? grep -iw $MATCH $HOME/white.list
ok

seems to work fine, without invoking any overflows in fgrep, it failed
to work if the user is local, where the username might be 'davek' and
not be davek(_at_)medphys(_dot_)ucl(_dot_)ac(_dot_)uk

Dallman suggested adding:

:0 fwih
* ^From:(.*\<)?\/[^(_at_)]+$
| formail -I"From: $MATCH(_at_)medphys(_dot_)ucl(_dot_)ac(_dot_)uk"

*before* the above rule, so that a username without a domain would have
my local domain (@medphys.ucl.ac.uk) appended, which would then be
looked up in the white.list as any other email address. The white.list
will contain
davek(_at_)medphys(_dot_)ucl(_dot_)ac(_dot_)uk, rather than just davek.

This however seems to break down if the username is between < and >,
which it frequently is.

I do however have some confusion about what is a valid 'From:' email
address:

Certainly these seem to come up a lot
a) Fred <fred(_at_)x(_dot_)com>
b) "Fred" <fred(_at_)x(_dot_)com>
c) <fred>

I don't know if there are any other possibilities. Are there ??? I'm
hoping (c) is the only possibility for internal mail.

Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6409 Fax: 020 7679 6269
Internal telephone: ext 46409
e-mail davek(_at_)medphys(_dot_)ucl(_dot_)ac(_dot_)uk


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail