From b0f4ab8a6d6ce1edbd09bdc59cf2ad55ebf82586 Mon Sep 17 00:00:00 2001 From: Son NK Date: Thu, 12 Dec 2019 21:11:01 +0100 Subject: [PATCH] use sendmail instead of send_message in reply phase to avoid unicode problem --- email_handler.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/email_handler.py b/email_handler.py index 91082389..f291cece 100644 --- a/email_handler.py +++ b/email_handler.py @@ -237,12 +237,13 @@ class MailHandler: envelope.rcpt_options, ) - smtp.send_message( - msg, - from_addr=alias, - to_addrs=[forward_email.website_email], - mail_options=envelope.mail_options, - rcpt_options=envelope.rcpt_options, + msg_raw = msg.as_string().encode() + smtp.sendmail( + alias, + forward_email.website_email, + msg_raw, + envelope.mail_options, + envelope.rcpt_options, ) ForwardEmailLog.create(forward_id=forward_email.id, is_reply=True)