Browsing articles from "September, 2009"
Sending HTML mail by mail()
<?php
-
$to = "nuhilmehdy@gmail.com";
-
$subject = "HTML Test";
-
$Name = "Nuhil"; //senders name. // This is just for display name
-
$email = "email@adress.com"; //senders e-mail adress. // I think this would be generated by the host automatically
-
$last_name = "Mehdy"; // A test variable for using in the html format
-
-
$message = '
-
<html>
-
<head>
-
<title>HTML email</title>
-
</head>
-
<body>
-
<p>This email contains HTML Tags!</p>
-
<table width="100%" border="1">
-
<tr>
-
<td>First Name </td>
-
<td>Last Name </td>
-
</tr>
-
<tr>
-
<td>Nuhil</td>
-
<td>'.$last_name.'</td>
-
</tr>
-
</table>
-
</body>
-
</html>
-
'; // Use ' (single quote) for defining the variable content if you use " (double quote) inside that html format OR use reverse method
-
-
$headers = "MIME-Version: 1.0" . "\r\n"; // Always set content-type when sending HTML email
-
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; // This defines the mail as html content
-
-
// More headers
-
$headers .= "From: ". $Name . " <" . $email . ">\r\n"; //optional headerfields
-
$headers .= "Cc: nuhil@yahoo.com" . "\r\n"; // For Cc sending you can use headers also
-
-
mail($to,$subject,$message,$headers);
-
?>




