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

Contact form ham triggers email with raw HTML #7179

Closed
iandunn opened this issue May 12, 2017 · 1 comment
Closed

Contact form ham triggers email with raw HTML #7179

iandunn opened this issue May 12, 2017 · 1 comment
Assignees
Labels
[Feature] Contact Form [Pri] High [Type] Bug When a feature is broken and / or not performing as intended

Comments

@iandunn
Copy link

iandunn commented May 12, 2017

@dd32 noticed that contact form submission will show the raw HTML if they get stuck in the Spam queue, and then are later approved and sent.

I don't have time to verify this right now, but I'm pretty sure that I introduced the problem in #6658, and missed a chance to fix it in #7018. I think that grunion_ajax_spam() needs to be updated to wrap wp_mail() calls in the same 2 filters that are set in Grunion_Contact_Form::process_submission().

Steps to reproduce the issue

I haven't verified these yet, but it should be:

  1. Submit a contact form with content that will cause it to get stuck in the spam filter
  2. Approve the comment so that the email is sent
  3. Open the email

What I expected

  1. The content-type header should be text/html
  2. The message body should contain rendered HTML

What happened instead

I haven't verified these yet, but I'm guessing that:

  1. The content-type header is text/plain
  2. The message body should contain HTML tags displayed as text symbols
@iandunn iandunn added [Feature] Contact Form [Type] Bug When a feature is broken and / or not performing as intended labels May 12, 2017
@iandunn iandunn self-assigned this May 12, 2017
@dd32
Copy link
Member

dd32 commented May 12, 2017

To confirm, the email in which the raw HTML is displayed indeed carries a Content-Type: text/plain; charset=UTF-8 header.

Here's a quick snapshot of the relevant headers / body:
screen shot 2017-05-13 at 9 54 45 am

iandunn added a commit that referenced this issue May 19, 2017
Previously the two `wp_mail()` calls in `Grunion_Contact_Form::process_submission()` had extra filters around them in order to support HTML messages. The `wp_mail()` call in `grunion_ajax_spam()` was missing those filters, though. That resulted in ham messages being sent with a `plain-text` content type, but with HTML markup in the body.

Sending all `wp_mail()` calls fixes that particular issue, and also makes it much less likely that a similar bug will happen in the future, because it is DRY.

Fixes #7179
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Contact Form [Pri] High [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

No branches or pull requests

3 participants