This code is tested with WordPress 4.6.1

Only thing you need to add is ‘Content-type’.

<?php
$message = ‘<html>
<head></head>
<body>
<h1>See It is simple</h1>
</body>
</html>’;
$headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”;
$headers .= ‘From: Yourname <test@test.com>’ . “\r\n”;
$subject = ‘Here is subject’;
$mail = wp_mail( $email_to, $subject, $message, $headers);

if ( $mail ){
echo ‘Mail sent successfully’;
} else {
echo ‘Oops, some error while sending email’;
}
?>

Advertisements