[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
This commit is contained in:
Martin Hertz 2022-05-06 20:51:20 +02:00 committed by Calum Lind
parent 47e548fdb5
commit ee3180fd94
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
1 changed files with 1 additions and 1 deletions

View File

@ -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