procmail
[Top] [All Lists]

Re: Scan the body, get attachment

2002-04-08 03:21:41
On Mon, 8 Apr 2002 svenwurth(_at_)braunstein(_dot_)de wrote:

Hi procmailers,

thanks for helping me the last time, i testet your suggestion a few minutes 
ago -- 
works fine  ;-)
Now i have another question -- i hope not to stupid one

I get in steady periods some mails (not realy amazing up to now),
I want to do:

- get a text field out of the body,  ( it's a date, i think i know how to 
search )
- save the attachment somewhere


        If you want ot extract the attacmnt:

:0 
* Has attacmnt here
| (mkdir -p /some/where && METAMAIL_TMPDIR=/some/where /bin/metamail -r -y -w
-q -x 2>/dev/null)


        I do it in a script because you need some sed(1) to do it correct
        and maybe you want to do more things (?):

:0                                                                              
* Has attacmnt here                                                             
| /usr/local/bin/extract 

        The script (/usr/local/bin/extract):

#!/bin/sh
dir=/var/tmp/$LOGNAME.$$
mkdir $dir
METAMAIL_TMPDIR=$dir
export METAMAIL_TMPDIR

sed '/^Content.*multipart\/alternative/s/alternative/mixed/' |
  /usr/bin/metamail -r -y -w -q -x 1>/dev/null 2>&1
#-------------------------------------

        The $LOGNAME is forward by procmail to the script.

Bye,
 Udi


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

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