procmail
[Top] [All Lists]

Re: How do I extract subject?

2000-03-12 10:52:59
On 12 March 2000, Mrinal Kalakrishnan <mrinal(_at_)mrinal(_dot_)dhs(_dot_)org> 
wrote:
Hi,

I receive certain files which are encoded using mmencode through
email. In the email, the subject line gives the name of the file.  So
I want to make a procmail recipe to automatically decode the file and
save it in that filename. But I don't know how to extract the subject
from the message and use it in the recipe itself.

My recipe looks like this:

:0
* (some conditions)
| formail -I "" | mmencode -u > filename

This extracts the body, passes it through mmencode -u, and saves it in
filename. Now I want filename to be taken from the subject of the same
message. Is there any way to do this?

    If the subject is the name of the file and nothing else, try this:

        :0 bw
        * (conditions)
        * ^Subject:[    ]+\/.*
        | mmencode -u >$MATCH

    Better yet, use uudeview [1], which can extract the name of the
file:

        :0 bw
        * (conditions)
        | uudeview -p /some/directory -i - >/dev/null 2>&1

    Regards,

    Liviu Daia

[1]: http://www.uni-frankfurt.de/~fp/uudeview/

-- 
Dr. Liviu Daia               e-mail:   Liviu(_dot_)Daia(_at_)imar(_dot_)ro
Institute of Mathematics     web page: http://www.imar.ro/~daia
of the Romanian Academy      PGP key:  http://www.imar.ro/~daia/daia.asc

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