WordPress’s wp_mail() function default content type is ‘text/plain’ which does not allow using HTML. To send HTML emails you 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 call your wp_mail
add a filter to wp_mail_content_type
to return ‘text/html’ as the content type.
add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); wp_mail('[email protected]', 'Subject', 'Message');
Don’t forget to set the content type filter to “text/plain” after you use the wp_mail function, to avoid any conflicts.
Full code will be
add_filter('wp_mail_content_type', create_function('', 'return "text/html"; ')); wp_mail('[email protected]', 'Subject', 'Message'); remove_filter( 'wp_mail_content_type',create_function('', 'return "text/plain"; ') );