WordPress set mail type to html

//Create function which will return content type

function set_html_content_type() {
     return 'text/html';
 }

//now add filter before wp-mail()

add_filter( 'wp_mail_content_type', 'set_html_content_type' ); // add content filter to html
 wp_mail($to, $subject, $message,$headers);
 remove_filter( 'wp_mail_content_type', 'set_html_content_type' ); // remove content filter

//remove filter after wp_mail()

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s