> From: Bryan Hoover
> Sent: Saturday, January 03, 2004 8:41 PM
[...]
> > >
> > > Notice in, HEADERTAGVAL=`formail -rztx To:`, there must be that space
> > > between the options, and the tag -- would not work on my
> system without
> > > it, and procmail tips page notes it as well.
> >
> > Interesting. Haven't heard about that glitch before. Do you
> have a URL to
> > the tips page?
>
> The line to search for reads:
>
> HEADER = `$FORMAIL -X ""` # The space after the X is vital.
>
> http://pm-doc.sourceforge.net/pm-tips-body.html
>

Thanks for the pointer. I think the situation discused in that example
is different than your usage. The space is required because formail needs
to see the explicit empty argument in order to know that it should return
all the headers.

I've always used this form with no problems:

FROM=`formail -rzxTo:`
REALLY_FROM=`formail -rtzxTo:`


> > The only refinement that I'd add to the recipe above is to quote
> > $HEADERTAGVAL,
> > just in the unexpected event that the sender's address had a
> space in it, or
> > some such:
> >
> > :0
> > * ? grep -i -x -q -F "$HEADERTAGVAL" $ADDRESSFILE
> > {
> >   ISMAILINGLIST=yes
> > }
>
> The reason being, I assume, is though it wouldn't match anyway, the
> quotes would prevent an error.
>

Yes. Procmail does its own variable substitution above, and if it saw
a space in the $HEADERTAGVAL it would view the resulting substitution
as two separate arguments. We don't expect spaces in the address, but it
won't hurt to bullet proof things a bit. While we're add it, we should add
a -e
switch as well (e-mail addresses can begin with a '-'). We can also squeeze
a few cpu cycles out if we don't make procmail/exec look up 'grep' on the
path.

GREP=/bin/grep

:0
* ? $GREP -ixqFe "$HEADERTAGVAL" $ADDRESSFILE
{
  ISMAILINGLIST=yes
}

FYI, RFC2822 (sec. 3.4) details the syntax of an e-mail address,
http://www.faqs.org/rfcs/rfc2822.html

This page will tell you whether a given address is syntactically valid:

http://www.breakingpar.com/bkp/home.nsf/Doc?OpenNavigator&U=87256B280015193F
87256C40004CC8C6
(short URL: http://tinyurl.com/3d98f)





-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to