I feel embarassed to ask this because I have seen this question asked several times. However none of the solutions seem to be working for me. My HTML is output as plain text in the body of e-mail sent through PHPMailer
I have read the PHPMailer documentation on Github and found answers like this PHPmailer sending HTML CODE and this Add HTML formatting in phpmailer on stackoverflow.
//Create a new PHPMailer instance
$mail = new PHPMailer(true);
// Set PHPMailer to use the sendmail transport
$mail->isSendmail();
//Set who the message is to be sent from
$mail->setFrom('xxx@yyy.com');
//Set an alternative reply-to address
// $mail->addReplyTo('replyto@example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('xxx@yyy.com');
//Set the subject line
$mail->Subject = 'Rework Report';
$body = file_get_contents('current/rework.txt');
$mail->Body= $body;
$mail->IsHTML = (true);
//Attach a file
//$mail->addAttachment('current/rework.txt');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
The output should be HTML in the body of the e-mail.