WordPress E-mails in HTML

WordPress sends e-mails in plain/text by default, and you can change that using the wp_mail_content_type filter. However, if you change the content type to text/html for all your e-mails, you might break some messages that contain links, because WordPress puts <angle brackets> around links.

From the RFC2396:

Using <> angle brackets around each URI is especially recommended as a delimiting style for URI that contain whitespace.

If you’re going to change the content type for all your e-mails issued by WordPress, don’t forget to rewrite the default messages with proper markup. You can do that with various other filters, like retrieve_password_message.

Finally, if you’re going to send e-mails in HTML, please make sure they all respond well to narrow screens on mobile devices, and preferably contain a plain/text version of the same message.

About the author

Konstantin Kovshenin

WordPress Core Contributor, ex-Automattician, public speaker and consultant, enjoying life in Moscow. I blog about tech, WordPress and DevOps.

2 comments