I am having issues with embedding a html body into my WordPress mail. As of now I have tried multiple code snippets and none seem to work.
What I am seeing right now is, that the email is being sent correctly, but the html code is typed in as text and not being displayed as html content.
I have included my code below
// Get the Customer billing email
$billing_email = $order->get_billing_email();
$subject = 'Your Email Subject';
// Message
$message = '
<html><body><p>Here are the birthdays upcoming in August!</p></body></html>
';
// To send HTML mail, the Content-type header must be set
$headers = array('Content-Type: text/html; charset=UTF-8');
wp_mail( $billing_email, $subject, $message );
I tried using some other code snippets I found on stackoverflow, and none of them have worked
Can anyone help me out?
2
Answers
This code now works I just needed to change the content type from text to html.
I think, you missed headers to add wp_mail function call. You declared but not used.