Wednesday, December 9, 2009

Send Email With PHP

PHP mail function has two implementations:
bool mail ( string $to , string $subject , string $message )
bool mail ( string $to , string $subject , string $message , string $headers)
 
There is also room for additional parameters:

RETURN:
returns true is the email appears to be valid. (If you send something to address@blah.com, it appears to be valid so this function would return true even though the mail won't be delivered)

<?php
$to      
= "address@blah.com";
$subject = "Email sent from PHP";
$message = "Hi there!";
$headers = "From: someone@example.com";

mail($to$subject$message$headers);
?>

No comments:

Post a Comment