Skip to content

Contact Form: Set message content type to restore compat with plugins#7018

Merged
eliorivero merged 1 commit intomasterfrom
fix/7003-mail-back-compat
Apr 24, 2017
Merged

Contact Form: Set message content type to restore compat with plugins#7018
eliorivero merged 1 commit intomasterfrom
fix/7003-mail-back-compat

Conversation

@iandunn
Copy link
Copy Markdown

@iandunn iandunn commented Apr 20, 2017

Some plugins override wp_mail() and replace PHPMailer with other libraries, like Zend Mail. Previously, we were relying on PHPMailer to correctly set the content type, but that never happens when other libraries are used. Because of that, the message can be sent out with a text/plain type, but contain HTML, making it difficult for users to read.

All plugins should respect the value of wp_mail_content_type, though, so this is a much more reliable method of setting the type to text/html.

Props georgestephanis, jeherve
Fixes #7003

Testing instructions:

  1. Install the Postman SMTP or Gmail SMTP plugins from the w.org repo
  2. Checkout master, and submit a contact form. You'll see the raw HTML because the content-type is text/plain
  3. Checkout this branch and repeat the test. It should display in HTML and have the content-type set to text/html

@kraftbj kraftbj added [Feature] Forms [Status] Needs Review This PR is ready for review. Bug When a feature is broken and / or not performing as intended labels Apr 20, 2017
@jeherve jeherve modified the milestone: 4.9 Apr 24, 2017
@dereksmart
Copy link
Copy Markdown
Contributor

Works well! just needs a rebase to fix conflicts :)

@dereksmart dereksmart added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Apr 24, 2017
@dereksmart
Copy link
Copy Markdown
Contributor

Fixed the conflicts -- this should be good to go!

@dereksmart dereksmart force-pushed the fix/7003-mail-back-compat branch from f61607d to cbbe89b Compare April 24, 2017 21:12
Some plugins override `wp_mail()` and replace PHPMailer with other libraries, like Zend Mail. Previously, we were relying on PHPMailer to correctly set the content type, but that never happens when other libraries are used. Because of that, the message can be sent out with a `text/plain` type, but contain HTML, making it difficult for users to read.

All plugins should respect the value of `wp_mail_content_type`, though, so this is a much more reliable method of setting the type to `text/html`.

Props georgestephanis, jeherve
Fixes #7003
@dereksmart dereksmart force-pushed the fix/7003-mail-back-compat branch from cbbe89b to 7f3a7b9 Compare April 24, 2017 21:13
@iandunn
Copy link
Copy Markdown
Author

iandunn commented Apr 24, 2017

Thanks Derek, that was on my list for today but you beat me to it :)

@eliorivero
Copy link
Copy Markdown
Contributor

Looks good!

@eliorivero eliorivero merged commit 7b24483 into master Apr 24, 2017
@eliorivero eliorivero deleted the fix/7003-mail-back-compat branch April 24, 2017 22:39
@eliorivero eliorivero removed the [Status] Ready to Merge Go ahead, you can push that green button! label Apr 24, 2017
jeherve added a commit that referenced this pull request Apr 24, 2017
eliorivero pushed a commit that referenced this pull request Apr 25, 2017
* Changelog: initial commit for 4.9 release.

* Changelog: add #6929

* Changelog: move old changelogs to changelog.txt

* Readme: restore deleted release post link.

The post is now live.

* Changelog: add #6853

* Changelog: add #6856

* Changelog: add #6857

* Changelog: add #6884

* Changelog: add #6885

* Changelog: add #6892

* Changelog: add #6894

* Changelog: add #6898

* Changelog: add #6899

* Changelog: add #6900

* Changelog: add #6909

* Changelog: add #6927

* Changelog: add #6947

* Chagelog: add #6958

* Changelog: add #6961

* Changelog: add #6963

* Changelog: add #6965

* Changelog: add #6986

* Changelog: add #7000

* Changelog: add #7013

* Changelog: add #7015

* Changelog: add #7019

* Changelog: add #7028

* Changelog: add #6998

* Changelog: add #6999

* Changelog: add #7044

* Changelog: add #6881

* Changelog: add #6922

* Changelog: add #6940

* Changelog: add #6962

* Changelog: add #6942

* Changelog: add #6959

* Changelog: add #7018

* Changelog: add #6948

* Changelog: add #6657

* Changelog: add #7030

* Changelog: add #7048

* Changelog: add #7031

* Changelog: add #6990

* Changelog: add #6957

* Changelog: add #7027
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug When a feature is broken and / or not performing as intended [Feature] Forms [Pri] High

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants