Python 3 smtplib send with unicode characters
问题 I'm having a problem emailing unicode characters using smtplib in Python 3. This fails in 3.1.1, but works in 2.5.4: import smtplib from email.mime.text import MIMEText sender = to = 'ABC@DEF.com' server = 'smtp.DEF.com' msg = MIMEText('€10') msg['Subject'] = 'Hello' msg['From'] = sender msg['To'] = to s = smtplib.SMTP(server) s.sendmail(sender, [to], msg.as_string()) s.quit() I tried an example from the docs, which also failed. http://docs.python.org/3.1/library/email-examples.html, the Send