procmail
[Top] [All Lists]

Re: How do I match from a tedt file?

2002-08-11 05:39:28
On Sun, 11 Aug 2002, Dave Kirkby wrote:

DK>
DK> I have a rule in my .procmailrc, which mathes one email address.
DK>
DK> :0
DK> * ^From:(_dot_)*someone(_at_)foo(_dot_)com
DK> $MAILDIDR/ok
DK>
DK> I want to have lots of such rules, but it would be much easier to add them
DK> if the email addresses could be in a 'whitelist' file, so I could get
DK> the effect of the above rules ofr any email addres in the file.
DK>
DK> How can I do this?
DK>



FROMHEADER=`formail -c -rtz -x To:`

:0 :
*  ? echo "${FROMHEADER}" | grep -F -isx -f $PMDIR/list.white
$MAILDIDR/ok



where list.white has one address per line:


blobby(_at_)example(_dot_)com
fred(_at_)example(_dot_)com


Make sure that list.white is never an empty file or grep gets upset.


You probably shouldn't have the 'i' in -isx in the grep as I think the
local part of mail addresses should be case sensitive but, as the
Microsoft software at work seems to ignore that sort of thing, it may be
better to use the 'i'


I'm not sure how to extract the address from the from: header.  I ususally
use the formail -t header.


Alan

( Please do not email me AS WELL as replying to the list. Personal
  email is welcome but may invoke a password autoresponder. )



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