procmail
[Top] [All Lists]

Re: Best way to extra To: address?

1999-02-15 07:26:38
* Fri 1999-02-12 Lars Kellogg-Stedman <lars(_at_)larsshack(_dot_)org> 
list.procmail
* Message-Id: <E10BJrj-0005Hi-00(_at_)mx(_dot_)larsshack(_dot_)org>
| 
| Frequently, I want to extract just the user(_at_)host portion of the To: 
address
| 
|   To: Lars Kellogg-Stedman <lars(_at_)larsshack(_dot_)org>
|   --> lars(_at_)larsshack(_dot_)org
| 
| My current solution looks something like this:
| 
|   :0
|   TO=|formail -I From -R To: From: | formail -rtzx To:

Others have commented how to generate the return address, but I gather that you
simply want the Email part grabbed from the post and don't care about the
return address (formail -rt tacle that and there is no alternative).

To explode email to components, I've written procmail module pm-jaaddr.rc
which does all the job without invoking any extra shell, so the the burden
to the system is minimal:

    RC_EMAIL = $PMSRC/pm-jaaddr.rc

    :0
    * ^To:\/.*
    {
        INPUT     = $MATCH
        INCLUDERC = $RC_EMAIL  # will explode to components 
    }

After this the variable $ADDRESS contains the "lars(_at_)larsshack(_dot_)org" 
portion.
See pm-code.shar kit from the file server mentioned in the
headers. Docs attached.

jari

Attachment: pm-jaaddr.man
Description: Binary data

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