On Wed, 3 Dec 1997, Bishop & Bebe wrote:
What I want to do is take the senders name from an incoming email and
add it to an existing list.
... I have no idea if the incoming mail will have From:, X-Sender:, or
what. But I want to be able to know who is requseting certain files.
I think the only fields you're likely to consistently encounter a name in
are the "From:" and "Reply-To:", maybe "Sender:" or "X-Sender:". Here is
an untested recipe that you could start with that should get the contents
of the first recipient field it encounters with a name in front of an
address. The output to the file would include the address in these
examples.
FILE=/use/a/full/pathname
:0 chiw :$FILE$LOCKEXT
* ^(Reply-To|From|(X-)?Sender):\/.*[a-z0-9].*<(_dot_)*(_at_)(_dot_)*>
| echo $MATCH >> $FILE
To get more elaborate: Append to the file and then sort the file by last
name, then first name, deleting duplicate entries as well:
FILE=/use/a/full/pathname
:0 chiw :$FILE$LOCKEXT
* ^(Reply-To|From|(X-)?Sender):\/.*[a-z0-9].*<(_dot_)*(_at_)(_dot_)*>
| echo $MATCH >> $FILE;sort +1 -u $FILE -o $FILE
One could design a more elaborate sort. This one's fairly crude, but
should make readable files with a sort on lastname in most cases.
In both recipes the mail continues through your procmail.
David Hunt
dh(_at_)west(_dot_)net