[issue4403] regression from 2.6: smtplib.py requiring ascii for sending messages

August Mueller report at bugs.python.org
Tue Nov 25 21:35:09 CET 2008


August Mueller <gus at flyingmeat.com> added the comment:

For completeness, if anyone runs across this in the future, the following seems to work for sending utf-8 mail 
in python 3:

import smtplib
import email.mime.text

msg = email.mime.text.MIMEText("Ümlaut", _charset="UTF-8")

smtp = smtplib.SMTP('localhost')
smtp.sendmail('gus at flyingmeat.com', 'gus at flyingmeat.com', "Subject: This is your mail\n" + msg.as_string())
smtp.quit()

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4403>
_______________________________________


More information about the Python-bugs-list mailing list