mail function allows you to send email directly from a PHP script. recipient can be
either a single email address or a comma-delimited list of addresses.
If you want to set extra headers—for instance, in order to use Cc: or
Bcc:—these may be placed in a newline-delimited string in the extra_headers
parameter. As of PHP you can also specify extra arguments to the
system mail program in the extra_arguments parameter.
<?php
$to = "example@gmail.com";
$subject = "example test";
$body = "test message test message test message test message.";
$headers = "From:Deba\r\n";
$headers .= "Reply-To: example@testsite.com\r\n";
$headers .= "Return-Path: example@testsite.com\r\n";
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
?>
TRUE is returned if the function completes successfully;
otherwise, FALSE is returned. However, this gives no indication as to
whether the email ever reached its destination. This function fails
if any of recipient , subject , or message is left out, or if the
system's mail program fails for some reason.
either a single email address or a comma-delimited list of addresses.
If you want to set extra headers—for instance, in order to use Cc: or
Bcc:—these may be placed in a newline-delimited string in the extra_headers
parameter. As of PHP you can also specify extra arguments to the
system mail program in the extra_arguments parameter.
<?php
$to = "example@gmail.com";
$subject = "example test";
$body = "test message test message test message test message.";
$headers = "From:Deba\r\n";
$headers .= "Reply-To: example@testsite.com\r\n";
$headers .= "Return-Path: example@testsite.com\r\n";
$headers .= "X-Mailer: PHP5\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
mail($to,$subject,$body,$headers);
?>
TRUE is returned if the function completes successfully;
otherwise, FALSE is returned. However, this gives no indication as to
whether the email ever reached its destination. This function fails
if any of recipient , subject , or message is left out, or if the
system's mail program fails for some reason.