php dynamic email format

<?php
$to = ‘user@example.com’;
$subject = ‘My Email’;
$msg = “<html>
<head>
<title>Title of email</title>
</head>

<body>
<p align=’center’> <img src=’http://www.mydomain.com/Images/Logo.jpg&#8217; width=’210′ height=’45’> </p>

<table cellspacing=\”4\” cellpadding=\”4\” border=\”1\” align=\”center\”>

<tr>
<td align=\”center\”>Name</td>
<td align=\”center\”> John</td>
<td align=\”center\”>Age</td>
<td align=\”center\”>20</td>
</tr>

<tr>
<td align=\”center\”>Empid</td>
<td align=\”center\”>0014 </td>
<td align=\”center\”>Depart</td>
<td align=\”center\”>IT</td>
</tr>

<tr>
<td align=\”center\”>Salary</td>
<td align=\”center\”>20000</td>
<td align=\”center\”>Country</td>
<td align=\”center\”>US</td>
</tr>

</table>
</body>
</html>”;

// Make sure to escape quotes

$headers = ‘MIME-Version: 1.0’ . “\r\n”;
$headers .= ‘Content-type: text/html; charset=iso-8859-1’ . “\r\n”;
$headers .= ‘From: My Site Name <me@mysite.com>’ . “\r\n”;

mail($to, $subject, $msg, $headers);

?>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s