0
votes

When I try to send a mail with the sender module and I have non-Ascii-Characters in the password (like ยง), I get an error:

'ascii' codec can't encode character '\xa7' in position 4: ordinal not in range(128)

Is there any way to circumvent this?

1
This is caused by a bug in the smptlib module which sender depends on. - ekhumoro

1 Answers

0
votes

EDIT:

Due to the comment from @ekhumoro, I just wanted to link to this question, whose answer proposes a couple of solutions to the problem you're having (as there is no official solution). The three possible solutions given are:

  1. patching the smtplib.py file to use UTF-8 rather than ascii
  2. using a different mail client
  3. changing your password

OLD ANSWER:

looking at the code for sender.py module in the sender library, it looks like there is support for UTF-8 now built in. try making sure you're using python 3 and the latest version of the library.

if this still isn't working for you, there is a fix in this thread-- essentially, you change this line in sender.py charset.add_charset('utf-8', charset.SHORTEST, None, 'utf-8')

to this charset.add_charset('utf-8', charset.SHORTEST, charset.BASE64, 'utf-8')

I haven't tried it and can't confirm, let me know if it helps.