Reputation: 641
$to = '[email protected]';
$subject = 'Coupon Claimed!';
$header = 'From: [email protected]';
$claimed = '<html><body>';
$claimed .= '<h1>Hello, World!</h1>';
$claimed .= '</body></html>';
mail($to, $subject, $claimed, $header);
I have this simple html php email but when it is sent everything including tags gets included.
googled tutorials show similar examples like the code i did, would like to know how I can only send the div content.
Upvotes: 0
Views: 141
Reputation: 2003
You need to add the Content-type to your header like this:
$to = '[email protected]';
$subject = 'Coupon Claimed!';
$claimed = '<html><body>';
$claimed .= '<h1>Hello, World!</h1>';
$claimed .= '</body></html>';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= 'From: [email protected]\r\n';
mail($to, $subject, $claimed, $headers);
Upvotes: 2