[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I extract subject?
On 12 March 2000, Mrinal Kalakrishnan <mrinal@mrinal.dhs.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.Daia@imar.ro
Institute of Mathematics web page: http://www.imar.ro/~daia
of the Romanian Academy PGP key: http://www.imar.ro/~daia/daia.asc