[Tutor] rfc822.Message [reading emails from mailboxes]
Kristian Rink
afterimage@gmx.net
Sun Mar 16 03:57:02 2003
Hi Danny, and thanks lots for the reply...
[snip]
> > >>> mailmessage=rfc822.Message("2")
> > Traceback (most recent call last):
[snip]
> >
> > Btw Message "2" is a mail file inside a MH mail spool directory.
> The main problem is that Python has no way of guessing where your MH mail
> spool directory is located! Some part of your code will need to point
> that location to Python by directory name.
Hmmm, I already thought of something like this, as well. Then again, the
traceback
I got used to appear while interactively running python inside the MH
folder, inside the
same folder where the "2" file is / was located so I thought python would
try to open
the file in the current working directory. Seems it ain't working this
way...
> Instead of directly using rfc822, you probably want to use the 'mailbox'
> module:
>
> http://www.python.org/doc/lib/module-mailbox.html
Okay, I'll take a look at it, thanks. :) Then again, in the end the progam
is thought
to be used to run over messages inside a directory structure created by the
cyrus
IMAP daemon so I wonder if those will be accepted as "mailboxes"...
> If you'd like, I can post up a somewhat extended example of 'mailbox' use
> tomorrow. I've been working on a Jython program to run the Jakarta Lucene
> text indicer on the Tutor mailing list. So your question is nicely
> timed... *grin*
>
> The code is still very very rough, so I need another afternoon to polish
> it up and comment it nicely, but if it looks ok, I'd be happy to share it
> on Tutor for feedback.
Would be really appreciated, if you don't mind :) Even an uncommented
listing
would do.
Thanks again, have a nice sunday...
Cheers from Dresden,
Kris
--
+++ GMX - Mail, Messaging & more http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!