procmail
[Top] [All Lists]

Re: formail query

1998-11-03 11:22:17
On Tue, 3 Nov 1998 22:48:51 +0530, "Somiya"
<somiya12(_at_)bom5(_dot_)vsnl(_dot_)net(_dot_)in> wrote:
     I need to redirect the incoming mail to a cgi script. I have
to extract the headers & the body from the incoming mail since I
have to store the information in a database. I have been told that
this can be done using formail for extraction & procmail for
redirection. Can anybody give me the code to do this.

If you want them both saved to files, separate files, you don't need
formail.

    :0hc:
    headerfile
    :0:
    bodyfile

sed is actually good enough if all you want to do is separate out the
two without any further filtering.

    sed -n -e '1,/^$/w headerfile' -e '/^$/,$w bodyfile' < input

You'll need some additional logic if you want to avoid saving the neck
(the empty line which separates the headers from the body) but it's
not all that complicated.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
<HTML>

Please turn off this annoying misfeature in your mail client.

Hope this helps,

/* era */

-- 
Bot Bait: It shouldn't even matter whether  (`')  Just  (`')  http://www.iki
I am a resident of the State of Washington   \/ Married! \/   .fi/~era/

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