HTML mail() Sending as Plain Text

0 min read 78 words
$to = "[email protected]";
$subject = "SUBJECT";
$message = "<b>MESSAGE</b>";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Mailer ' . "\r\n";
mail($to, $subject, $message, $headers);

The above code does not always send emails in HTML as it should, it turns out there is a PHP Bug (http://bugs.php.net/15841 ) that comes into play with QMAIL and carriage returns.
If this is the case you should replace “\r\n” with a “\n” only.

Tags:
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags