email_body_msg = "victim’s reach"
char between m and s is non ascii character.
char between m and s is non ascii character.
smtplib (python) cannot handle this. So what is the solution?
Simple solution, Just convert all the email_body_msg to base64.
Steps:
1) Use another python lib:
from email.mime.text import MIMEText
2) Use UTF-8
message = MIMEText(email_body_msg, _charset="UTF-8")
3) convert MIMEText back to string
smtplib.SMTP.sendmail(self.mfrom, receivers, message.as_string())
good read:
http://betterexplained.com/articles/unicode/
http://betterexplained.com/articles/unicode/
No comments:
Post a Comment
Terima kasih