Im sending out an order conformation for recipients via the simple mail function built into PHP, and this works fine. It’s a “nice” email set up in tables and a few styles with the details in it
However a few of the recipients just see html tags, and of course can’t understand anything..
If i get one, it shows perfectly in thunderbird, hotmail, gmail..
The html is perfect, not missing any end tags, and i send some headers also as i have read i should. this is my mail send function:
$body = "some html tags, set up in a table" ;
$sendto = "The recipients email here" ;
$subject = "subject here" ;
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1'."\r\n";
$headers .= "To: theemailhere <theemailhere>\r\n";
$headers .= 'From: <thefromemailhere>' . "\r\n";
mail($sendto, $subject, $body, $headers);
Is this an error from my side, or has the recipient chosen not to receive html emails? I mean is this still possible in 2012 and do people disable this??
And if so, what could be a good workaround to do this. I mean i would like to avoid using plain text.
Yes. There are really email clients which do not allow HTML emails. I guess older Outlooks are one of these, too, but not sure.
So, anyway, it is not your fault, it is the user’s. See Source 1 and Source 2.
And you can never be sure what does the user’s mail program accept. Only plaintext is surely accepted. Quoting Source 2:
It can be solved only with multipart messages, but then some people will get plaintext. See Source 3 for some details on the issue and Source 4 for solutions.
Some documents on this: Source 1, Source 2, Source 3, Source 4