procmail
[Top] [All Lists]

Re: a problem regarding procmailrc

2002-05-07 08:53:37
On  7 May, Ali, Imran wrote:
| Hi .
|       I have to extract sender's mail id and have to pass it to a script.
| right now i am using .
| WHOFROM = `formail -xFrom:`   for this purpose but since in my mails from
| header have name along with e-mail i.e.
|  From: "ali imran" <aliimran(_at_)rediffmail(_dot_)com> , so above formail 
statement
| extract whole thing, i mean name as well as e mail id.
| 
| But i want only email id i.e. aliimran(_at_)rediffmail(_dot_)com to be stored 
in
| WHOFROM .
| How can i do it . ?
| 

This will extract an email address from the From: header, which may or
may not be the sender but seems to be what you want. It will not
capture anything to WHOFROM if there is no "@" in the header (e.g. bang
paths, or local non-fully qualified addresses).

:0
* ^From:.*\/[^  @]+(_at_)[^     ]+
{ WHOFROM = $MATCH }

or, to eliminate the <> pair around the address

:0
* ^From:.*\/[^  @<]+(_at_)[^     >]+
{ WHOFROM = $MATCH }

N.B. whitespace within the [classes] is a <space> and a <tab>.

-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


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

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