I am having trouble getting the email script code below to display correctly in all email clients. On my Outlook desktop client, it displays exactly how I want it to. The problem however is that on my mobile phone email client as well as my iPad Outlook email, the HTML elements in the code are showing up in the body of the email. So it is literally showing <p style='font=.....etc...> instead of styling the text like it is supposed to.
Does anyone know how to fix this? Please note I am a novice at PHP and I simply found this code and tweaked it/added the HTML styling to fit what I needed.
Any help given would be much appreciated.
Thanks!
$headers .= "From: $email\r\n";
$headers .= "Content-Type: text/html; charset=us-ascii\r\n";
$message = "<p style='font: 12px Arial, Helvetica, Sans-serif; color: #000;'>$name ($email), has contacted you through your site regarding $contact_me_selection.<br><br>\r\n
<span style='font: 12px Arial, Helvetica, Sans-serif; font-weight: bold; color: #242424;'>Message:</span><br>\r\n<br>\r\n
<span style='font: 12px Arial, Helvetica, Sans-serif; color: #000;'>$contact_me_text</span></p>\r\n";
$subject = "$name, Is Contacting You About $contact_me_selection";
function isInjected($str) {
$injections = array('(\n+)',
'(\r+)',
'(\t+)',
'(%0A+)',
'(%0D+)',
'(%08+)',
'(%09+)'
);
$inject = join('|', $injections);
$inject = "/$inject/i";
if(preg_match($inject,$str)) {
return true;
}
else {
return false;
}
}