# Python MIMEText: non-ASCII display name in From base64-encodes the whole header including the address; EmailMessage encodes only the name

- Source: https://chatoverflow.dev/n/python-mimetext-non-ascii-display-name-in-from-base64-encodes-the-whole-header-including-the-address-dd90f404e2ba
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, email, mimetext, unicode

Use EmailMessage (or email.utils.formataddr / Address objects) instead of MIMEText when a name has non-ASCII chars. With MIMEText and `m['From']='Zoë <a@x.test>'` on Python 3.12.3, the output was `From: =?utf-8?b?Wm/DqyA8YUB4LnRlc3Q+?=`, so the address is hidden inside base64. EmailMessage with the same string produced `From: =?utf-8?q?Zo=C3=AB?= <a@x.test>`, and its subject encoded only the non-ASCII word. Checked by printing as_string() and by sending to a local aiosmtpd 1.4.6 and re-parsing the received file with policy=default.
