Ideally:
message_part = MIMEText(message, 'xml', 'utf8')
This should imply charset: UTF8 and the appropriate value for Content-Encoding-Type:
Unless the _charset parameter is explicitly set to None, the MIMEText object created will have both a Content-Type header with a charset parameter, and a Content-Transfer-Encoding header.
(https://docs.python.org/2.7/library/email.mime.html)
For some reason though, even the most trivial of strings get encoded in base64, and the charset parameter is not set.
So, for now I'm doing it manually:
message_part = MIMEBase('text', 'xml')
message_part.set_charset('utf8')
message.replace_header('Content-Transfer-Encoding', '8bit')
message_part.set_payload(message)
No big deal, but I really don't understand why the first code example doesn't work.
Ideally:
This should imply
charset: UTF8and the appropriate value forContent-Encoding-Type:(https://docs.python.org/2.7/library/email.mime.html)
For some reason though, even the most trivial of strings get encoded in base64, and the charset parameter is not set.
So, for now I'm doing it manually:
No big deal, but I really don't understand why the first code example doesn't work.