Here is a snip of code that is causing me problems. Earlier in the code it queries the database and retrieves two emails. One row has a format = Plain and the other row has a format = HTML, for testing purposes. The line of code giving me grief is $mail->MsgHTML($body); If I use “This is <b>bold</b> test” instead of $body then it works fine. I do have a very simple testEmail.html in the same directory as this PHP script, so that is not the problem. Can you see anything else that may be causing the SMTP error to show, “Mailer Error () Message body empty” ?
Thanks!
if ($row[format] == "Plain") {
$mail->Body = $row["message"];
} else {
$body = file_get_contents('testEmail.html');
$body = preg_replace('/[\\]/','',$body);
$mail->MsgHTML($body);
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
}