Make WordPress Core

Opened 6 years ago

Last modified 2 years ago

#11376 new feature request

wp_mail should run MsgHTML for HTML emails

Reported by: batmoo Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Mail Keywords: has-patch 2nd-opinion
Focuses: Cc:


PHPMailer has a function called MsgHTML that sets the email as isHTML and automatically adds HTML and plain text versions of the message to the email.

wp_mail should run this function if $content_type is set to text/html to allow for max compatibility with email clients.

Should note: WordPress doesn't currently send HTML emails so this is more of a benefit for plugins. But if we go down the road for HTML emails with core, this will be useful...

This is a quick fix, so I can patch it up.

Attachments (1)

wp_mail-MsgHTML.diff (642 bytes) - added by batmoo 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 @nacin5 years ago

  • Component changed from General to Mail
  • Keywords needs-patch 2nd-opinion added
  • Milestone changed from Unassigned to Future Release

If you want to attempt a patch, that'd be good.

That said, since we don't send HTML emails in core, any plugin wishing to override the content type should also be hooking into the action in wp_mail that receives the phpmailer object by reference. So tempting to wontfix this, but I'll move to future release for now.

@batmoo5 years ago

comment:2 @batmoo5 years ago

Patch attached, but may as well wontfix this, since the plan text version created by PHPMailer is terrible (e.g. doesn't pull out links from <a> tags), so I'm not sure if it's really worth it.

comment:3 @batmoo5 years ago

  • Keywords has-patch added; needs-patch removed

comment:4 @codebykat2 years ago

  • Cc kat@… added
Note: See TracTickets for help on using tickets.