tlovett1 / custom-contact-forms

Build beautiful custom forms and manage submissions the WordPress way.
https://taylorlovett.com
161 stars 50 forks source link

removed MIME-Version, it gets duplicated #330

Open sandropons opened 7 years ago

sandropons commented 7 years ago

it seems that Wordpress phpmailer already inserts MIME-Version in mail headers. When "custom contact form" plugin sends the notification email, it adds the MIME-Version header and it gets duplicated. Servers may not accept the mail, resulting the error: 554 Transaction failed: Duplicate header 'MIME-Version'.

robbytx commented 6 years ago

👍 I am encountering this same problem, sending through Amazon SES.

This seems to be a common problem for many Wordpress plugins, as a simple google search for "wordpress duplicate mime-version" shows.

robbytx commented 6 years ago

@tlovett1 is there any chance you would merge and release this in the near future?

PHPMailer in Wordpress Core clearly adds the same header (and appears to have done so for some time): https://github.com/WordPress/WordPress/blob/5eb452d15b4d99fcd19bc97dd53876547c7b2655/wp-includes/class-phpmailer.php#L2110

Also, the wp_mail docs have an example shown passing the Content-Type header without the MIME-Version header: https://developer.wordpress.org/reference/functions/wp_mail/#comment-348

Since the core wp_mail function always calls PHPMailer, this seems like a fairly straightforward change with a relatively low chance of regression. (Of course, I'm not a Wordpress plugin dev, so possibly I'm overlooking something.)