[Email-SIG] bug possibility

Eric S. Johansson esj at harvee.org
Wed Apr 21 16:23:06 EDT 2004


Eric S. Johansson wrote:

> I gathered 
> there is some magic one can use with generators that would be useful in 
> fixing this problem but so far, that escapes me.  Enlightenment would be 
> appreciated.

after I wrote this, enlightenment dawned (googled??) in the form of 
__call__ and a couple of other bits.


def message_becomes_string(message, UNIX_from=False):

     string_file = StringIO()
     mail_Cuisinart = email.Generator.Generator(string_file, maxheaderlen=0)
     mail_Cuisinart(message, UNIX_from)
     return string_file.getvalue()


so make that three workarounds.  Two ugly, one not quite so bad.

---eric




More information about the Email-SIG mailing list