Issue with smtplib sending mail with unicode characters in Python 3.1

You can instead just use:

msg = MIMEText(message, _charset="UTF-8")
msg['Subject'] = Header(subject, "utf-8")

But either way you still have issues if your frm = "[email protected]" or to = "[email protected]" constains unicode characters. You can’t use Header there.

Leave a Comment