procmail
[Top] [All Lists]

Re: to extract "From: " address properly

2019-04-10 02:19:58
On 2019-04-09 23:19, Zhiliang Hu wrote:
I am using a recipe to catch the email address in "From: " line
to build a "white list", with this to extract the address:

     FROM=`formail -zX From: | formail -c -rt -xTo:`
or  FROM=`formail -zX From: | formail -zrx To:`
or  FROM=`formail -rtzxTo:`

procmailex mentions: FROM='formail -rt -xTo:'


Test your expressions:

echo -en 'From foo1\nFrom: foo2\nTo: bar\nCc: baz\n' |formail -rt -xTo:
 foo2


it works fine for some of the time, but once a while it ends up with
a "foo@bar". I wonder why... (is it sometimes the top of the "From " line?)

See also https://rvtol.home.xs4all.nl/procmail/basic/pm/
which doesn't use formail.

Be prepared to handle encoded headers (base64, quoted-printable).
(see the pure-procmail-decoders, or MIME in procmailex)


procmailex also mentions:

DEFAULT=|

which is good for debugging.

-- Greetings, Ruud
____________________________________________________________
procmail mailing list -- procmail(_at_)lists(_dot_)rwth-aachen(_dot_)de   
Procmail homepage: http://www.procmail.org/
To unsubscribe send an email to 
procmail-leave(_at_)lists(_dot_)rwth-aachen(_dot_)de
https://lists.rwth-aachen.de/postorius/lists/procmail.lists.rwth-aachen.de

<Prev in Thread] Current Thread [Next in Thread>