May 31, 2000
7:36 p.m.
"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?
<bling!>
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)
I think this does the trick, as long as ListAdmin and Message.Enqueue both use repr(msg) instead of str(msg). Sendmail and SMTPDirect continue to use str(msg).
I've tested this and it all appears to work.
-Barry