Thursday, 23 October 2008

SendMail with PHP


Heres a snippit ive used to send mail with PHP. Your mail server must be configured with your php installation, then your all set.


$EmailSubject = "Hello World Test";
$EmailFrom = "JoeBloggs@TutorialGenius.co.uk";
$EmailTo = "User@TutorialGenius.co.uk";
$Message = "Hi, I'm sending this quick E-Mail to test my PHP Mail functionality! Thanks TutorialGenius.com!";
 
 
$result = mail($EmailTo, $EmailSubject, $Message, "From: $EmailFrom");
 
 
if ($result == 1)
{
     echo "Mail sent sucessfully!";
}
else
{
     echo "There was an error sending the mail.";
} 

No comments: