Tecnativa/docker-duplicity

Encoding Error

Closed this issue · 3 comments

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?

In this case it's the char "é" I guess. But it's the same with every char which is not in the ASCII table.

https://stackoverflow.com/questions/56759272/how-do-i-send-an-e-mail-with-some-non-ascii-characters-in-python

Tardo commented

Mails are now sent with MimeText utf-8