Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

xxxconhd, www...xxxcon, xx3ooo com, event ID 1078, simba cs, smtp-server: 421 4.3.2 Connection rate limit exceeded., wwwxxx.c, www.xxx.con, mdazadmd00@gmai.com, wwwxxx

Links

XODOX
Impressum

#1: extracting body of a message

Posted on 2007-12-29 21:56:25 by siva.misra

Mail gurus:

I am looking for examples as to how I can extract certain parts of
mail message body using perhaps procmail.
For example if I receive a email containing just a single word in the
body, I want to have the procmail echo that word so that it can be fed
as stdin to a script via pipe.

Any help or suggestions will be much appreciated.

Thanks
Siva

Report this message

#2: Re: extracting body of a message

Posted on 2007-12-30 09:32:06 by Garen Erdoisa

siva.misra@gmail.com wrote:
> Mail gurus:
>
> I am looking for examples as to how I can extract certain parts of
> mail message body using perhaps procmail.
> For example if I receive a email containing just a single word in the
> body, I want to have the procmail echo that word so that it can be fed
> as stdin to a script via pipe.
>
> Any help or suggestions will be much appreciated.
>
> Thanks
> Siva

--------
Procmail Example 1:

# The $$ string expands to the current process ID.
TEMPFILENAME="${HOME}/message.body.tmp.$$"

# Extract a copy of the message body in the pipeline to a file
:0 cb
${TEMPFILENAME}

# Note the backticks that launch an embedded script. The output
# of the script will be stored in the BUFFER procmail variable.
# Also note that the buffer variable has a max limit of 60000
# characters, which can be an issue if you are looking at a large
# message body depending on what your custom script does.
LINEBUF=60000
BUFFER=`cat ${TEMPFILENAME} |somescript ; rm -f ${TEMPFILENAME}`

---------
Procmail Example 2:

# Feed a message body to an embedded script
# This method uses formail to extract the message body
# by surpressing all the message headers and avoids having
# to create a temporary file. However the same issue with
# the message body size remains.
LINEBUF=60000
BUFFER=`formail -I "" |somescript`

--
Garen

Report this message