Friday, March 13, 2015

HTML Email with PHP

<?php
$to = "sender@gmail.com";
$subject = "Testing Email From ";
//  '  "
$message =  '
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Testing Email From</p>

 <div style="color:#0000FF float:"left" ">
  <img src="http://www. v   .com.au/app/img/nslogo.png" width="150" height="150">
</div>

<table width="350" height="100" float:"left" border="0" border-color: #666 align="left" cellpadding="0" cellspacing="0" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;">

<tr>
<td height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif;    font-size: 24px;font-weight: bold;color: #2D9348;padding-left: 5px;">Dear Student ! </td>
</tr>

<tr>
<th align="left">Firstname</th>
<th align="left">Lastname</th>
</tr>
<tr>
<td>Indika</td>
<td align="left">Senavirathne</td>
</tr>

<tr>
<td>Address</td>
<td><strong>Kuruvikulama</strong> </td>
</tr>
</table>

</body>
</html>
 ';

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: <sender@gmail.com@gmail.com>' . "\r\n";
$headers .= 'Cc: sender@gmail.com@gmail.com' . "\r\n";

mail($to,$subject,$message,$headers);
?>

No comments:

Post a Comment