Page 1 of 1

sending mail via SMTP from localhost to internet (yahoo, gma

PostPosted: 25. April 2008 14:54
by 2108
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 :D

PostPosted: 25. April 2008 16:10
by Nobbie
Which mail server software do you have on your PC? How is it configured?

PostPosted: 25. April 2008 16:28
by 2108
I'm using the Mercury mail server which comes with XAMPP, i've started that on the XAMPP control panel and went to status to see that SMTP service is activated.

Anything im missing here? :?

PostPosted: 25. April 2008 22:12
by Nobbie
>Anything im missing here?

Yes, the whole configuration.

PostPosted: 25. April 2008 23:03
by 2108
ok, so where can i go from here?

PostPosted: 25. April 2008 23:21
by Nobbie
Read documentation?!

PostPosted: 25. April 2008 23:35
by 2108
Nobbie wrote:Read documentation?!


wow, you really must be a genius at this :roll:

anyone else have a SOLUTION?

Thanks!

PostPosted: 26. April 2008 00:08
by Wiedmann
Warning: mail() [function.mail]: SMTP server response: 550 RCPT TO:<new@new.com> Relaying not allowed - please use SMTP AUTH in

Somewhere in Mercury is a setting "Do not permit SMTP relaying of non-local mail", just change this.