procmail
[Top] [All Lists]

Re: Procmail and attachments

1996-11-18 01:15:28

I got hold of munpack, but after reading the man page for it I've 
realised it does not write text MIME parts. Do you know where I can get 
the full manual for procmail saying what ':O HBw' and others means. Even 
better still, could you write a little script that will make procmail 
write out the attachments to files.

[manpage]
munpack - unpack messages in MIME or split-uuencode format [ ]  [
]  [  ] [ ] [ ] The program reads each RFC-822 message and writes
all non-text MIME parts or split-uuencoded files as files.
[end]


I use metamail for that and it works perfectly decoding any binary
data to file and leaving plain text in the income box. When any
attachment presents it inserts a text into the message like this:

:This message contains data in an unrecognized format, multipart,
:which is being decoded and written to the file named 
"/usr/violet/mail/attached/mm.a006Uv".
:If you do not want this data, you probably should delete that file.
:Wrote file /usr/violet/mail/attached/mm.a006Uv

Fragment of file .procmailrc doing that:

METAMAIL_TMPDIR=$HOME/mail/attached
:0 fhb
* ^Content-Type:.*
| metamail  -d -x | formail

There is one thing however to get it work properly: you need to
adjust metamail to handle standard input properly.

As I understood formerly metamail was written for operating under
DOS and AMIGA and there is a problem reading standard input in Unix
( at least  in version 2.7 )

To fix that it's enough to comment out those lines in file metamail.c:

    if (UsingStandardInput && feof(InputFP) && !freopen("/dev/tty", "r", 
stdin)) {
        fprintf(stderr, "Warning: Cannot freopen /dev/tty to stdin");
    } else InputFP = stdin;

Think it is possible to have metamail do the same with UUENCODE.

-- 
------------------------------------------------------------------------
    Sergey A. Mukhin                    |    
violet(_at_)staff(_dot_)rosmail(_dot_)com
    Network Administrator               |    http://violet.rosnet.ru/
    Russian Telecommunications Network  |    Tel: + 7 095 755 85 88
    Moscow, Russia                      |         + 7 095 206 62 15
------------------------------------------------------------------------
*     If you can't learn do it well learn to enjoy doing it badly.     *
------------------------------------------------------------------------

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