From ee3180fd94bf47ccf2dc95e10d716c8080a4ea71 Mon Sep 17 00:00:00 2001 From: Martin Hertz Date: Fri, 6 May 2022 20:51:20 +0200 Subject: [PATCH] [Notifications] Fix UnicodeEncodeError upon non-ascii torrent name smtplib.SMTP.sendmail expects 'msg' in string of ascii chars or bytes, where the former gets encoded to bytes through ascii codec, hence raising said error, but now fixed by encoding to bytes ourself through utf-8 Closes: https://github.com/deluge-torrent/deluge/pull/383 --- deluge/plugins/Notifications/deluge_notifications/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deluge/plugins/Notifications/deluge_notifications/core.py b/deluge/plugins/Notifications/deluge_notifications/core.py index d48d449ba..aa200f9bd 100644 --- a/deluge/plugins/Notifications/deluge_notifications/core.py +++ b/deluge/plugins/Notifications/deluge_notifications/core.py @@ -148,7 +148,7 @@ Date: %(date)s try: try: - server.sendmail(self.config['smtp_from'], to_addrs, message) + server.sendmail(self.config['smtp_from'], to_addrs, message.encode()) except smtplib.SMTPException as ex: err_msg = ( _('There was an error sending the notification email: %s') % ex