Home | Forums | Tutorials | About Domain

PHP Mail :: PHP Mail with HTML :: PHP Tutorial

Code:
<?php
$email
="example@example.com";
$subject="My Subject";
$body="My Body";
$from="info@example.com";
mail($email$subject$body"FROM: $from");
?>

Code:
//php mail with HTML
<?php
$email
="example@example.com";
$subject="My Subject";
$body ='
<HTML>
<head>
<style>
body
{
background-color: #0000CC;
margin-left:  10em;
margin-top: 1em;
font-family: "Trebuchet MS";
font-size:   24px;
color:    "#FFFFFF";
}
</style>
</head>
<body>
My HTML Mail
</body> '
;
$headers='MIME-Version: 1.0' "\r\n";
$headers .= 'Content-type: text/html; charset=utf8' "\r\n";
$headers .= 'From: System <noreply@example.com>' "\r\n";
mail($email$subject$body$headers);
?>

discuss this topic to forum

01/01/10