<?php
SendEmail("[email protected]","Dima", "trololo");
function SendEmail($to,$user_name, $user_password)
{
$subject="Political forum: registration";
$body = 'Your user name is: ".$user_name <br/>'.$user_name.' Your password is: '.$user_password.'<br/><br/> Click the link below for validation: <a href="#">Validation_Link</a>';
$headers="FROM: $to\r\n";
$headers.=" Content=type: text/html\r\n";
if (mail($to, $subject, $body, $headers)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
}
?>
The above fails!!!
I had a little read and I found that you need to change this inyour php.ini:
; For Win32 only. ; http://php.net/smtp SMTP = localhost ; http://php.net/smtp-port smtp_port = 25
; For Win32 only. ; http://php.net/sendmail-from sendmail_from = [email protected]
I did, but it still fails
Message:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\PoliticalForum\StoredProcedure\User\email.php on line 16
Message delivery failed...