How to send email with HTML tags in PHP
$to = 'example@example.com';
$subject = 'Testing Mail with HTML';
$message = '<html><body>';
$message .= '<table rules="all" style="border-color: #666;" cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>Name:</strong> </td><td>" . strip_tags($_POST['name
']) . "</td></tr>";
$message .= "<tr><td><strong>Email:</strong> </td><td>" . strip_tags($_POST['req-email
']) . "</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
// The Header section define that which type of mail do you want to send i.e Content-Type: text/html;
$headers = "From: myself@myemail.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to, $subject, $message, $headers);
No comments:
Post a Comment