PHP mail



mail() function can send plain text mail as well as HTML mails. If successful, return true, otherwise false.

<?PHP
	$body = "Hello:\n This is a test mail.\n";	
	$to = "test@example.com";
	$subject="PHP Test Mail.";
	$header = "From:support@example.com \r\n";
	if (!mail($to, $subject, $body, $header))
	{
	   echo "mail failed!";
	}
?>

<?PHP
	$body = "Hello:\n This is a <b>test</b> mail.\n";	
	$to = "test@example.com";
	$subject="PHP Test Mail.";
	$header = "From:support@example.com\r\n";
	$header .= "Cc:master@example.com\r\n";
	$header .= "MIME-Version: 1.0\r\n";
	$header .= "Content-type: text/html\r\n";
	if (mail($to, $subject, $body, $header))
	{
	    echo "mail failed!";
	}
?>