flask-mail
flask-mail copied to clipboard
Unicode pt-BR
Is there a simple way to configure flask-email to accept unicode pt-BR?
This is flask-mail configuration:
msg = Message(
subject,
sender=mail_settings.get("MAIL_USERNAME"),
recipients=[email],
body='Olá como vai você'.encode('utf-8'),
charset='utf-8'
)
I get the following error:
msg = _fix_eols(msg).encode('ascii')
UnicodeEncodeError: 'ascii' codec can't encode character '\xe1' in position 322: ordinal not in range(128)
Strangely the subject accepts unicode
Well you are passing utf-8 bytes and not unicode for the body right now...
which parameter to configure to pass the unicode?
A body with unicode characters seems to be supported correctly, no .encode call needed.