We can use mail function of PHP to send emails. For sending HTML email we've to set some headers.
Here is the syntax..
$from="test@test.com";
$to="test@test.com";
$subject="your subject";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
if (mail($to,$subject,$message,$headers) )
{
echo 'Successfully sent';
} else {
echo "Email address is not valid";
}
$to="test@test.com";
$subject="your subject";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= "From: ".$from."\r\n";
$headers .= "Reply-To: ".$from."\r\n";
$headers .= "Return-Path: ".$from."\r\n";
if (mail($to,$subject,$message,$headers) )
{
echo 'Successfully sent';
} else {
echo "Email address is not valid";
}
No comments:
Post a Comment