Skip to content

Instantly share code, notes, and snippets.

@WhiteCat6142
Created January 23, 2023 06:12
Show Gist options
  • Save WhiteCat6142/a6ca1f69fbef24ca5f20ca971a223c98 to your computer and use it in GitHub Desktop.
Save WhiteCat6142/a6ca1f69fbef24ca5f20ca971a223c98 to your computer and use it in GitHub Desktop.
# https://ideone.com/BLQ2FM
# https://blog.tmtms.net/entry/2015/12/07/mime-header-encoding
# https://docs.python.org/ja/3/library/email.message.html
from email.message import Message
from email.header import Header
msg = Message()
h = Header('MIMEヘッダエンコーディングは複雑すぎてつらい', 'utf-8',77,'Subject')
msg['Subject'] = h.encode()
print(msg.as_string())
print(h.encode())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment