-
Notifications
You must be signed in to change notification settings - Fork 135
Amazon SES mangles non-ASCII message bodies if using open/click tracking #115
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
Comments
Huh, very weird. Thanks for verifying the RawMessage sent to SES is the same in both cases. FWIW, that message looks valid, which makes this seem like an SES bug. It might be helpful to compare the "show original" version of the two messages as received in your email client, to see what Amazon SES is mangling when using a configuration set. Django (and therefore Anymail) uses Python's underlying email package to generate the raw mime message. I can't think offhand of an easy way to convince it to use some other transfer encoding on particular MIME parts, though my memory is that the Python 2.7 email package tends to favor It's going to be several days before I'd be able to take a closer look at this. It might be worth opening an issue with Amazon or on StackOverflow; you could remove Anymail and Django from the equation by capturing isolating the boto3 SendEmailRaw params similar to how you captured the RawMessage Data above. |
OK, I've tracked this down to what appears to be an Amazon SES bug: if you are using open or click tracking, when SES rewrites your message to add the tracking pixels/links, it mangles any Here are two immediate workarounds:
I think I've also found a way to work around the SES bug in Anymail's backend, but it will require more testing. (I'll report the bug to Amazon first; obviously it would be preferable for them to fix SES.) |
Thank you to possible workarounds! It works, but any way, all of this is a hack or limits the possibilities. Waiting for SES will fix this bug |
Here's the bug report to SES: https://forums.aws.amazon.com/thread.jspa?threadID=287048 |
Workaround released in Anymail v4.0. |
Hello!
I've got encoding problems for Amazon SES with SES Event Publishing for non-ASCII characters:

I found out that this problem only shows up when using
AMAZON_SES_CONFIGURATION_SET_NAME
(event tracking with SES Event Publishing)I also found out that the email content (
RawMessage
->Data
) is identical both when usingAMAZON_SES_CONFIGURATION_SET_NAME
and without it.The problem is the way Amazon SES with SES Event Publishing treat with 'utf-8' encoding email content if
Content-Transfer-Encoding: 8bit
:Content-Transfer-Encoding: base64
works well, but how Anymail can use it?How to reproduce:
By the way https://docs.aws.amazon.com/ses/latest/DeveloperGuide/send-email-raw.html use
Content-Transfer-Encoding: base64
The text was updated successfully, but these errors were encountered: