How to Send HTML Emails From WordPress Using wp_mail Function
You can use WordPress’s wp_mail() function to send emails from your WordPress site. However, the default content type is ‘text/plain’ which does not allow using HTML. If you want to send HTML emails then you will need to set the content type of the email to “text/html” by using the ‘wp_mail_content_type’ filter.This is how you can do that:
before you send your wp_mail call add a filter to wp_mail_content_type
add_filter('wp_mail_content_type','set_content_type');
Then in your set_content_type function have it return the appropriate content type, in this case ‘text/html’
function set_content_type($content_type){
return 'text/html';
}
A More Compressed Way to Set the Mail Content Type to HTML
add_filter('wp_mail_content_type',create_function('', 'return "text/html"; '));
wp_mail('whoever@whatever.com', 'Subject', 'Message');
Related posts:
No tags for this post.



Information was helpful, can you tell me how to receive all parameters of the WP_MAIL ( $to, $from, $subject,$message)in a hook or filter?
This might help:
http://codex.wordpress.org/Function_Reference/wp_mail
Leave your response!
Search
Categories
Ads
Recent Posts
Recent Comments