Headers should be handled case-insensitively #20

Open
robneu opened this Issue Jan 10, 2017 · 5 comments

Projects

None yet

2 participants

@robneu
robneu commented Jan 10, 2017

Not sure what the deal is, but GravityForms sends notifications in plain text format when the drop-in is activated. Seems to be related to the content type headers somehow as they come through as text/plain

@robneu
robneu commented Jan 10, 2017

Definitely seems to be an issue with the headers, setting the $message_args['headers']['Content-Type'] default to apply_filters( 'wp_mail_content_type', 'text/html' ) fixes the issue.

I'm sure it probably breaks other things though. I'm not sure why that filter isn't being set correctly by gforms.

@rmccue
Member
rmccue commented Jan 11, 2017

My guess would be differing defaults. Can you trace down the wp_mail call and find what's passed into it?

@robneu
robneu commented Jan 11, 2017

Looks like it's a case sensitivity thing. It passes in Content-type rather than Content-Type in the headers.

@rmccue
Member
rmccue commented Jan 11, 2017

That was my second guess :) Headers are case-insensitive, so we should take this into account when we're merging this. Potentially, we can use Requests_Utility_CaseInsensitiveDictionary which is designed for exactly this purpose, but likely overkill here.

@rmccue rmccue added the bug label Jan 11, 2017
@rmccue rmccue changed the title from GravityForms sends in plain text to Headers should be handled case-insensitively Jan 11, 2017
@robneu
robneu commented Jan 11, 2017 edited

After a bit more digging, it looks like the real issue is that in this case the headers are being unset here.

You end up with an empty array before the camel case conversion runs and the defaults are merged.

I'm having a little trouble wrapping my head around exactly why all the values are being unset though...

@robneu robneu added a commit to robneu/aws-ses-wp-mail that referenced this issue Jan 11, 2017
@robneu robneu Unset header before setting a new one
Fixes #20
536a15c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment