Sending HTML email via PHP mail function

Ya kali-kali aja bisa dijadikan bahan acuan tentang,

Kirim HTML formatted email menggunakan mail() punyanya PHP

// multiple recipients
$to  = “<aji@aji.com>”; // note the comma
$to .= “,<ajiprabowo@ajiprabowo.com>”;
// subject
$subject = “Test”;
// message
$message = “
<html>
<head>
<title>Pre Registration Information</title>
</head>
<body>
<h1>test</h1>
<table>
<tr>
<th>Name</th><th>Phone</th><th>Email</th>
</tr>
<tr>
<td>$name</td><td>$phone</td><td>$email</td>
</tr>
</table>
</body>
</html>
“;
// To send HTML mail, the Content-type header must be set
$additional_headers = “Content-type: text/html;” .”\n”;
// Additional headers
$additional_headers .= “From: <aji@aji.com>”.”\n”;
$additional_headers .= “Return-path: <aji@aji.com>”.”\n”;
//$additional_parameters = “-f aji@aji.com”;
$additional_parameters = “”;
// Mail it
mail($to, $subject, $message,$additional_headers,$additional_parameters);

—–

source: daniweb.com

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s