You’ve probably come across this error before. I cannot seem to fix it.
Gmail seems to be ignoring my HTML emails and is just showing the code.
All other clients (or all that I know of) are displaying the content correctly.
Here is my code (with certain things changed to hide the name)
$to = "$EmailAddress";
$subject = "My subject!";
$headers = "From: no-reply@mydomain.co.uk\r\n" .
"X-Mailer: php";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$message = '<html><body>';
$message .= '<center><img width="300px" src="http://www.mydomain.co.uk/images/mylogo.png"/><br />';
$message .= '<br /><br />';
$message .= '<h2>Hello '.$UserName.',</h2>';
$message .= '<b>Thanks for joining!</b><br /><br />';
$message .= 'Please find your login details below.';
$message .= '_____________________________________<br /><br />';
$message .= 'Username: '.$UserName.'<br/>
Password: '.$Password.'<br />
<br />';
$message .= '_____________________________________<br /><br />';
$message .= 'Thanks,<br/>My company.<br/>';
$message .= '<br/><a target="_new" href="http://www.mydomain.co.uk"/>www.mydomain.co.uk</a>';
$message .= '</center>';
$message .= 'my company © 2012';
$message .= '</html></body>';
$success = mail($to,$subject,$headers,$message);
my Question is, is there a way to either offer an alternative plain text version of the email should the email client not be able to read this code or is there something I need to add in order for Gmail to understand it?
I apologise if this is a duplicate, but I cannot seem to find this question on here.
Thanks in advance.
you have some typo’s in your code, i don’t know how other client displaying content correctly. i worked on them and got succeeded, hope will work for u too, try this;
This is what u looking for