[FRPythoneers] (no subject)

Jeffery D. Collins jcollins_boulder at earthlink.net
Thu Jul 29 14:10:49 MDT 2004

I have no experience in this matter, but have you looked at the 
email.Generator module?  This may be an oversimplification, but here goes:

(saved an email message in 'message')

import email
m = email.message_from_file('message')
fp = file('message')
m = email.message_from_file(fp)

fh = open('jnk_message','w')
g = email.Generator.Generator(fh)
# loop over all messages here?

Aside from some minor formatting differences, the contents of 'jnk_message' is 
the same as 'message'.

On Thursday 29 July 2004 12:55 pm, Keith Hellman wrote:
> Hello all.
> I've written some python quick code to open numerous different
> traditional unix mbox files and search all the messages for ones of
> interest.  Python made this, what thought would be the hard part,
> incredibly easy.
> Now I'm stuck trying to write the found messages (of type email.Message)
> back to a new traditional unix mbox file.  I'd like to do this so I can
> simply use mutt prune the found messages down to just the ones I want.
> Everything I've seen so far is for *reading* mbox files, does anyone
> know how to write an email.Message to one?  I'm also humoured that it
> seems impossible to perform simple google searches for an answer since
> anything with 'mail' and 'python' in it finds the 13 bazillion helpful
> message boards explaining where the term spam comes from :^)


More information about the FRPythoneers mailing list