[Spambayes] IMAPFilter
Oliver Maunder
lists at olivermaunder.co.uk
Wed Apr 16 12:08:59 EDT 2003
Hi all
I've been playing around with imapfilter.py, which is shaping up very
nicely (thanks Tony and Tim!).
However, I'm having a couple of problems with the latest version, which
isn't too surprising. To quote Tim's CVS comment:
"IMAP seems to be a really flukey kind of interface, and until it's been used
on lots of imap servers, by lots of people, I won't be convinced that it's
really correct."
Well, for a start my IMAP server doesn't seem to like the preserved
timestamps on the messages. The error message is
Timestamp: Wed, 02 Apr 2003 10:12:56 +0100
Traceback (most recent call last):
File "C:\Development\SpamBayes\spambayes\imapfilter.py", line 415, in ?
imap_filter.Filter()
File "C:\Development\SpamBayes\spambayes\imapfilter.py", line 323, in
Filter
folder.Filter(self.classifier, self.spam_folder, self.unsure_folder)
File "C:\Development\SpamBayes\spambayes\imapfilter.py", line 279, in
Filter msg.Save()
File "C:\Development\SpamBayes\spambayes\imapfilter.py", line 151, in Save
time_stamp, self.as_string())
File "C:\Program Files\Python22\lib\imaplib.py", line 296, in append
return self._simple_command(name, mailbox, flags, date_time)
File "C:\Program Files\Python22\lib\imaplib.py", line 925, in
_simple_command
return self._command_complete(name, apply(self._command, (name,) +
args))
File "C:\Program Files\Python22\lib\imaplib.py", line 762, in
_command_complete
raise self.error('%s command error: %s %s' % (name, typ, data))
imaplib.error: APPEND command error: BAD ['Invalid date-time in Append
command']
Second problem is that my IMAP server doesn't like messages with bare
newlines. It expects lines to end with \r\n, and refuses to APPEND
messages with lines that end in just \n. The easiest thing to do would
be to just replace single \n's with \r\n. I'm sure that with the power
of python it won't need more than one line of code to do this, but I'm a
total python newbie. Anyone care to enlighten me as to what this line
might be?
Olly
More information about the Spambayes
mailing list