From: "Anna Savarino" <asavarino(_at_)jacobacciperani(_dot_)com>
...
Hi
I receive every night an e-mail with an attach-file (is a text containing a
list of words).
Are you sure that it's a text file, not "microsoft word" or
"wordperfect" or "rich text"?
I must extract the attach and then I must execute a shell that reads the
file ecc.
How can I do this ?
:0 c
* ^From.*root
* ^Subject:.*prova
$MAILDIR/provamailcap
The above makes a backup copy
METAMAIL_TMPDIR=$HOME/domini
:0 bbHB
* ^From.*root
* ^Subject:.*prova
|metamail -w -q -x
The above looks OK to me.
It writes something under the directory domini, but I really don't
understand how to read it. Can somebody help me? There is something wrong?
Let's assume that metamail decodes the file correctly; then we have
only the question of what that file is.
Could you try this? Remove the "-q" from the metamail recipe and run
procmail on a single message. Then metamail should tell you something
about the data. Or, you could look at one of the messages and see
what the "Content-Type:" fields say. That should give a clue.
I tried "metamail -w -x" on a message I received recently with
attachments, and it told me this (I previously set METAMAIL_TMPDIR to
/tmp/mail).
This message contains 'text/plain`-format data.
which is being decoded and written to the file named "/tmp/mail/mm.a16882".
If you do not want this data, you probably should delete that file.
Wrote file /tmp/mail/mm.a16882
This message contains 'application/msword`-format data.
which is being decoded and written to the file named "/tmp/mail/ovrvw.doc".
If you do not want this data, you probably should delete that file.
Wrote file /tmp/mail/ovrvw.doc
This message contains 'application/vnd.ms-excel`-format data.
which is being decoded and written to the file named "/tmp/mail/program.xls".
If you do not want this data, you probably should delete that file.
Wrote file /tmp/mail/program.xls
______________________________________________________________________________
I'd suggest a few minor changes to make the recipes easier to read:
1. Test conditions only once, and group the result in one place.
2. Describe briefly what you're doing; this will help novices reading
your file in the future.
3. remove extraneous flags (":0 bbHB" -> ":0 b")
4. Indent conventionally
Putting them together...
:0
* ^From.*root
* ^Subject:.*prova
{
# Make a backup copy
:0c
$MAILDIR/provamailcap
METAMAIL_TMPDIR=$HOME/domini
# Unpack the attachment
:0 b
|metamail -w -q -x
}
cheers
--
Neither I nor my employer will accept any liability for any problems
or consequential loss caused by relying on this information.
Collin Park Not a statement of my employer.
19111 Pruneridge Ave - MS 47UA Voice: +1-408-447-5570 (T-447-5570)
Cupertino, CA 95014-0714 USA Fax: +1-408-447-7902
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail