Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set utf-8 encoding in the MIMEText constructor #2210

Merged
merged 2 commits into from
Aug 25, 2017

Conversation

daveFNbuck
Copy link
Contributor

Description

Pass the e-mail encoding into the MIMEText constructor rather than

Motivation and Context

If this is not set during the constructor, an exception is thrown in Python 2 when the e-mail body contains unicode.

Have you tested this? If so, how?

Added a unit test, deployed to production but it'll take a while before I see any unicode e-mails.

If this is not set during the constructor, an exception is thrown in
Python 2 when the e-mail body contains unicode.
With base64 encoding, the e-mail tests fail trying to validate subject
and body contents. Using email.parser allows us to safely decode
whatever encoding is used and verify the subject and body separately,
resulting in slightly better validation as well.
@daveFNbuck
Copy link
Contributor Author

This is now tested in production, and I'm getting e-mails with unicode in them. Turns out R scripts use unicode single quotes around package names in error messages.

@dlstadther
Copy link
Collaborator

@daveFNbuck Feeling good about this? Ready to merge?

@Tarrasch Tarrasch merged commit e5a2956 into spotify:master Aug 25, 2017
@daveFNbuck daveFNbuck deleted the unicode_email branch August 25, 2017 16:25
@daveFNbuck
Copy link
Contributor Author

Yes, it was ready.

@Tarrasch
Copy link
Contributor

Oh, forgot to say. Thanks for this PR @daveFNbuck :)

This was referenced Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants