Decode II (more complex)

John Bokma john at castleamber.com
Mon Jun 21 14:19:52 EDT 2010


Thomas Lehmann <t.lehmann at rtsgroup.net> writes:

>> Your email(s) get send as 7 bit (ASCII). Email them as utf-8 and I guess
>> your problem is solved.
>>
>> How do you email the notifications?
>>
>
>  I was copying partly the logic from http://code.activestate.com/recipes/473810
>  Changing to buffer.decode("utf-8", 'replace') where I'm reading the
> file and
>  changing the html template at top to utf-8 leads to following output:

Most likely you have to do something like this

msgText = MIMEText('your HTML utf-8 message')
msg.set_charset('utf-8')
msgAlternative.attach(msgText)

Or:

msgText = MIMEText('your HTML utf-8 message', 'utf-8')       [1]
msgAlternative.attach(msgText)


[1] with a quick Google I found one message stating that this didn't
work for utf-8, in Python 3.1.1, see: 
http://mail.python.org/pipermail/python-list/2010-March/1238611.html

-- 
John Bokma                                                               j3b

Hacking & Hiking in Mexico -  http://johnbokma.com/
http://castleamber.com/ - Perl & Python Development



More information about the Python-list mailing list