<<< Date Index >>>     <<< Thread Index >>>

Re: extracting sender's name for use in a script?



Am 2006-08-07 13:58:23, schrieb Kyle Wheeler:
> Then you can extract headers in your script like so:
> 
>     #!/bin/sh
>     message="`cat -`"
>     sender="`echo "$message" | 822field From`"
>     recipient="`echo "$message" | 822field To`"
>     CCrecipients="`echo "$message" | 822field CC`"
>     subject="`echo "$message" | 822field Subject`"

...or if you are using procmail

     message="`cat -`"
     sender="`echo "$message"       | formail -cx From:`"
     recipient="`echo "$message"    | formail -cx To:`"
     CCrecipients="`echo "$message" | formail -cx CC:`"
     subject="`echo "$message"      | formail -cx Subject:`"

Greetings
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSM LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)