Back to Top

How to Change WordPress Email Content Types To HTML

To change content Type of mail in WordPress

Here is the quick article about to explain How to Change WordPress Email Content Types To HTML.Wordpress has a function wp_mail to send mail from the site and by default the content type of wp_mail function is text/plain.

To change the content type of mail function, you need to filter the content type before used for WordPress.

In Web development or website, most important is to show user actual time other wise users get confused.

Let’s understand the code:

add_filter( 'wp_mail_content_type','wp_set_content_type' );

function wp_set_content_type(){
	return "text/html";

you can add the filter when you require or before you call function wp_mail and remove after calling a wp_mail function using below code.

remove_filter( 'wp_mail_content_type','wp_set_content_type' );

That’s it.Now you can send mail 🙂

Thank you for reading.Feel free to share your thoughts! Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

Step by step Node JS Tutorial for Beginner

Posted on 3 years ago


how to shake a div using jQuery

Posted on 6 years ago