Page 1 of 1

php mail sending with html

Posted: Sat Oct 18, 2014 3:16 pm
by cjkeane
Hi everyone,
I'm trying to send html emails but the emails are always received with the actual html tags, not displaying the html properly. I receive html emails from lots of companies, but when I try to send an email from an html form i created with php mail, I never receive the email correctly. I'm not sure what else to try. Any help would be appreciated. Thanks.

in the html of the page I have:

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />


in the php mail part I have this set:

Code: Select all

        $semi_rand = md5(time());
 	$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
	$headers .= "MIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
	$message ="--{$mime_boundary}\n";
	$headers .= "Content-Type: text/html; charset=utf8\r\n";
	$message.="Content-Transfer-Encoding: 8bit\n\n";

Re: php mail sending with html

Posted: Sat Oct 18, 2014 9:44 pm
by Christopher
Use SwiftMailer, PhpMailer, etc. MIME emails are tedious to get right.