[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Command-line/batch tools for handling mail attachments?



Hi

On Thu, 12 Jan 2006, Andrew Perrin wrote:

> For both of you, how about formail as a tool?

I already use formail for various tasks related to extracting messages 
from a mailbox - very useful.  However it doesn't handle decoding of 
attachments.

> Or, alternatively, Perl's mail handling modules like
> Mail::Mbox::MessageParser or Mail::MboxParser

Thanks for the tip.  The script is being written in Perl anyway, so these 
may very well be what I want.

It seemed initially that uudeview could do it all out of the box -
decoding MIME base64, uuencoding, BinHex etc.  It does that all very well
- even with broken boundary lines and missing headers etc.  However the
more I tested it the more problems I found with loss of the text part of
messages in the output, leading to the script getting more and more
complicated in order to be able to handle each exception. If I only knew
some C programming then I would edit uudeview to make it do exactly what I
wanted.

The most sophisticated implementation I have seen of Perl modules for
decoding is in Julian Field's MailScanner (virus scanner and spam
detector), which has to be able to decode almost any type of attachment
(even MS-TNEF) before sending it for virus scanning.  Sadly, the
sophistication of that kind of Perl programming is currently beyond me, 
and I just get totally lost.

However, if all else fails I will simply have to start learning more about
Perl.

> Andy (who used MANGOnet while in Zimbabwe in 1992)
 
(We are still going strong - we now have 2500 users even though FidoNet 
is getting very long in the tooth.)

Regards

Jim Holland
System Administrator
MANGO - Zimbabwe's non-profit e-mail service
 
> On Thu, 12 Jan 2006, Jim Holland wrote:
> 
> > Hi
> >
> > On 11 Jan 2006, Don McLaughlin wrote:
> >
> >> I'd appreciate any pointers to some command-line tools for doing the
> >> following.
> >>
> >> (1) Take mail and news messages as input files and produce as output
> >>     files the same messages but with all the attachments, HTML parts,
> >>     and other non-plain-text stuff deleted, keeping the headers and
> >>     the plain-text of the body, as if the sender had written the
> >>     message without attachments or HTML.
> >>
> >>     What I really want to do is use maildirs and news spools as input
> >>     and produce a directory of cleaned files, which will then be used
> >>     for corpus linguistics. But if I can find a straight filter
> >>     program (stdin, stdout) and I can write a script to find -exec it.
> >>
> >>     I looked at mimefilter but I don't want to generate outgoing
> >>     messages to the senders and all that.
> >>
> >> (2) Take a mail message file as input and output a directory
> >>     containing separate files of the decoded attachments and the text
> >>     of the message (preferably with the mail headers).
> >>
> >>     This would be for archiving my own e-mail.
> >
> > I am currently working on exactly this problem (for a FidoNet/Internet
> > mail gateway), but have no simple solutions.  The best utility that I have
> > come across so far is uudeview, which works well for extracting
> > attachments, but sadly it is not very good at keeping the headers and text
> > from the body of messages.
> >
> > Regards
> >
> > Jim Holland
> > System Administrator
> > MANGO - Zimbabwe's non-profit e-mail service
> >
> >
> >
> > -- 
> > To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> > with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> >
> >
> 




Reply to: