Wednesday, 14 August 2013

style in body message in sendmail php

style in body message in sendmail php

In the sendmail php i create table n if we fill & click submit button,
mail will receive successfully. I try some example code that i shown below
but it will print that all html code except that quotes. Now i want to add
some styles like tables or bold italic or add images in body of that mail
that is "$message" area... can anyone help ?
<?php
ob_start();
$to = "me@mymail.com";
$subject = "Request mail";
$message = "<html><body>";
$message .= '<img src="Images/Logos/Logo_color.png" alt="Logo" />';
$message .= '<table rules="all" style="border-color: #666;"
cellpadding="10">';
$message .= "<tr style='background: #eee;'><td><strong>Name:</strong>
</td><td>" .$Name.PHP_EOL. "</td></tr>";
$message .= "<tr><td><strong>Company Name:</strong> </td><td>"
.$Company.PHP_EOL. "</td></tr>";
$message .= "<tr><td><strong>Mobil Number:</strong> </td><td>"
.$Mobile.PHP_EOL. "</td></tr>";
$message .= "<tr><td><strong>Email Id:</strong> </td><td>"
.$Email.PHP_EOL. "</td></tr>";
$message .= "<tr><td><strong>Address):</strong> </td><td>"
.$Address.PHP_EOL. "</td></tr>";
$message .= "<tr><td><strong>State:</strong> </td><td>" .$State.PHP_EOL.
"</td></tr>";
$message .= "<tr><td><strong>Edition:</strong> </td><td>"
.$Edition."</td></tr>";
$message .= "</table>";
$message .= "</body></html>";
$from = "mail@yourdomain.co.in";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
header('Location: http://yourdomain.co.in') ;
?>

No comments:

Post a Comment