Skip to content

Instantly share code, notes, and snippets.

@berkerpeksag
Last active June 12, 2016 07:52
Show Gist options
  • Save berkerpeksag/d7a87a6cda9375e93a5c71f53cece854 to your computer and use it in GitHub Desktop.
Save berkerpeksag/d7a87a6cda9375e93a5c71f53cece854 to your computer and use it in GitHub Desktop.
import email
import email.policy
from email.mime.multipart import MIMEMultipart
m = email.message_from_string('', policy=email.policy.default)
m['To'] = '[email protected]'
m['To'] = '[email protected]' # will raise ValueError
# and here is an alternative way
m = MIMEMultipart()
m.policy = email.policy.default
m['To'] = '[email protected]'
m['To'] = '[email protected]' # will raise ValueError
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment