Hi, I have written a command-line program to send email using
from email.message import EmailMessage which has an option '--verbose' which prints the email via if args.verbose: print(f"{mail.as_string()}") If I run this with $ poetry run send_email loris -l en -s "Another test" -t ~/tmp/blorp_bleep.txt --verbose the following is printed to the terminal: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 From: h...@zedat.fu-berlin.de To: lo...@zedat.fu-berlin.de Subject: Another test RGVhciBEci4gQmVubmV0dCwKCkJsb3JwISBCbGVlcCEKCgotLQpNYWlsYm90IEluYy4KMDEwMTAx │ IEJvdCBCb3VsZXZhcmQKQm90aGFtIENpdHkKQsO2dGxhbmQK However I would like to see the text as Dear Dr. Bennett, Blorp! Bleep! Regards, Mailbot -- Mailbot Inc. 010101 Bot Boulevard Botham City Bötland which is how the text appears in the mail. The 'ö' in 'Bötland' triggers the encoding - with 'Botland' the text printed to the terminal is the same way as that in the mail. How do I decode the message properly for an terminal which uss UTF-8? Regards Loris -- This signature is currently under construction. -- https://mail.python.org/mailman/listinfo/python-list