Encoding Error
Closed this issue · 3 comments
ClementVincent commented
Hi,
I'm facing an encoding error when the mail is sent :
File "/etc/periodic/weekly/jobrunner", line 108, in <module>
smtp.sendmail(from_, to, "\r\n".join(message))
File "/usr/local/lib/python3.8/smtplib.py", line 859, in sendmail
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 1055
Is there a way to pre-encode (or remove wrong chars from the messages) before calling smtp.sendmail() ?
Thank you for your amazing job by the way ! :)
yajo commented
Humm what is it that triggers the error?
ClementVincent commented
In this case it's the char "é" I guess. But it's the same with every char which is not in the ASCII table.
Tardo commented
Mails are now sent with MimeText utf-8