Is there an action_hook or something similar that could help me achieve this?
I tried adding markup in a PHP string variable and just fired off an email with the wp_mail()
function like so:
$email_to = 'someaddress@gmail.com';
$email_subject="Email subject";
$email_body = "<html><body><h1>Hello World!</h1></body></html>";
$send_mail = wp_mail($email_to, $email_subject, $email_body);
But it showed up as plain text?
Any ideas?
from wp_mail codex page:
The default content type is ‘text/plain’ which does not allow using HTML. However, you can set the content type of the email by using the ‘wp_mail_content_type’ filter.
// In theme's functions.php or plug-in code:
function wpse27856_set_content_type(){
return "text/html";
}
add_filter( 'wp_mail_content_type','wpse27856_set_content_type' );