Re: Processing Email (Mbox-style) Folders

Chris Babcock <[email protected]>
Newsgroups gmane.mail.spam.crm114
Organization ASCII King Games
Message-ID <[email protected]>
> >    I've completed v. 0.1.0 of my first useful CRM script. It reads
> > an email off stdin, identifies the MIME part that contains the
> > sender's message, calls external programs as necessary to decode the
> > message and outputs an email that can be read by any RFC 822 or 2822
> > compliant mail client. It even rewrites the Content-Type and
> > Content-Transfer-Encoding lines in the main headers (if present).
> > 
> >    It would be helpful to be able to be able to batch process a mail
> > spool file and/or save the output in a file that could be processed
> > in the same way as a mail spool or Mbox folder. What would the CRM
> > idioms be for this?
> 
> If I recall correctly, one can toss stuff into the proper mailspool
> directory and the demon just takes it right from there.
> 
> However, unless you're using procmail to trigger whether CRM114
> needs to process the mail again or not, that might well give
> you an infinite loop of processing without delivery.
> 
> So, we'd need to know more particulars... though using procmail
> is the easy way out.  :)

I place limits on the kind of knowledge that I allow to contaminate my
mind. :-)

I'm working with CRM because of the 'and' factor. I can process mail
*and,* well, I've got a list somewhere. Most of it revolves around
creating user agents to produce filtered data feeds from sources as
diverse as gopher and Twitter. 

On the original question, processing mbox folders is going to be dirty
- especially with respect to the legacy application, which is quite
fortunate to break in a benign way. To make it work (for some
definition of 'work' that means that a paragraph sent as "From ..."
gets forwarded as ">From ..."), I only need to make sure that there's a
blank line at the end when I append a message to the archive. Of course
that approach is probably going to lead into file locking issues. 

I'll be putting this into trac hosting in 4-6 weeks along with a bunch
of other odds and ends.

Chris




-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.