On Wed, May 31, 2000 at 03:36:57PM -0400, Barry A. Warsaw wrote:
"BAW" == Barry A Warsaw <bwarsaw@python.org> writes:
BAW> SMTPDirect.py uses str(msg) too and inclusion of From_ in the BAW> body of the message seems to give at least Postfix all manner BAW> of willies. Maybe the thing to do is include another Message BAW> method which returns just the headers and body, sans the BAW> unixfrom, and use this in SMTPDirect and Sendmail?
Is it too much of a kludge to make __repr__() return the entire message, including the From_ header, and make __str__() return just the rfc822 headers and body? I.e.
repr(msg) == msg.unixfrom + str(msg)
Yeah, this works. My initial reserve against making str(msg) return the unixfrom line as well was that it broke 'compatibility' with the regular rfc822.Message. The SMTPDirect breakage shows that, I guess ;-) Using repr is a good idea, I think, but it's missing one thing: if unixfrom is empty, the mailbox will still be fawlty. I think __repr__ should reproduce a .unixfrom line if it's missing. I'll post a patch later today, I have to run off to a huge sale at the local bookstore ;-)
-- Thomas Wouters <thomas@xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!