Hi guys,
I'm trying to get a php script to send an e-mail from localhost to users e-mail address supplied (when htey register to my site) but i get the following error:
Warning: mail() [function.mail]: SMTP server response: 550 RCPT TO:<new@new.com> Relaying not allowed - please use SMTP AUTH in C:\xampp\htdocs\signuppost.php on line 36
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\signuppost.php:36) in C:\xampp\htdocs\signuppost.php on line 38
heres the script for my signuppost.php:
if(isset($_POST['txtemail']))
{
$query="SELECT * FROM tbl_user WHERE u_email='".$_POST['txtemail']."'";
$q=mysql_query($query);
$QRES = mysql_num_rows($q);
if($QRES == "0")
{
$query = "INSERT INTO tbl_user(user_name,user_password,u_email,u_level,user_regdate,`lname`, `address1`, `address2`, `city`, `state`, `zip`, `country`, `phone`) VALUES ('$fname','$password','$email',1,NOW(),'$lname','$add1','$add2','$city','$state','$zip','$country','$phone')";
//echo $query;
$ok=mysql_query($query);
if($ok)
{
$from = "localhost";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $form <$from>\r\n"."Reply-To: $form<$from>\r\n"."X-Mailer: PHP/" . phpversion()."\r\n";
$msg = "Dear User, Welcome to my site Thank you for choosing my site.";
mail($email,'Successful Registration with my site',$msg,$headers);
header("location: message.php?msg=suOK");
}
else
{
header("location: message.php?msg=suerr");
}
}else{
header("location: message.php?msg=suem");
}
}
in my php.ini i have:
;for win32 only
SMTP = smtp.localhost
smtp_port = 25
sendmail_from = localhost
please advise what i can do to get this to work
any help appreciated
thanks