Created By: Hitesh Patel (Asst. Professor, Grow More BCA – 9998531670) Page No. 23
10. Write a PHP program to send Mail from PHP Script.
Practical-10.php
<?php
error_reporting(0);
$to = "me@localhost";
$subject = "This is subject Subject";
$message = "<b>This is HTML message.</b>";
$message .= "<h1>This is headline.</h1>";
$header = "From:
[email protected] ";
$header = "Cc:
[email protected] ";
$header .= "MIME-Version: 1.0";
$header .= "Content-type: text/html";
$retval = mail ($to,$subject,$message,$header);
if( $retval == true )
{
echo "Message sent successfully...";
}
else
{
echo "Message could not be sent...";
}
?>
Output:
Message sent successfully...