[Spambayes] IMAPFilter

Oliver Maunder lists at olivermaunder.co.uk
Wed Apr 16 12:32:40 EDT 2003


Oliver Maunder wrote:

> 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?

Well, answering my own post, but I've now got  (in IMAPMessage.Save)
 
        msg = self.as_string().replace("\n", "\r\n")
        msg = msg.replace("\r\r\n", "\r\n")

which seems to work well enough to get the server to accept the message.

Olly





More information about the Spambayes mailing list