Jump to content
xisto Community
mrdee

Why This Error? PHP script fault

Recommended Posts

Hello,
I typed out a PHP script (literally copied from w3schools, the script is as follows:

<html><body><?phpfunction spamcheck($field)  {//eregi() performs a case insensitive regular expression match  if(eregi("to:",$field) || eregi("cc:",$field)) 	{	return TRUE;	}  else	{	return FALSE;	}  }//if "email" is filled out, send emailif (isset($_REQUEST['email']))  {  //check if the email address is invalid  $mailcheck = spamcheck($_REQUEST['email']);  if ($mailcheck==TRUE)	{	echo "Invalid input";	}  else	{ 	//send email	$email = $_REQUEST['email']; 	$subject = $_REQUEST['subject'];	$message = $_REQUEST['message'];	mail("info@vlaanderen=flanders.org.uk", "Subject: $subject",	$message, "From: $email" );	echo "Thank you for using our mail form";	}  }else//if "email" is not filled out, display the form  {  echo "<form method='post' action='mailform.php'>  Email: <input name='email' type='text' /><br />  Subject: <input name='subject' type='text' /><br />  Message:<br />  <textarea name='message' rows='15' cols='40'>  </textarea><br />  <input type='submit' />  </form>";  }?></body></html>

Yet, when I run it, I keep getting the following error:

Warning: mail() [function.mail]: SMTP server response: 530 Authenticate before sending emails. in C:\Program Files\Abyss Web Server\htdocs\mailform.php on line 34
Thank you for using our mail form.

Judiging by the last line, the script continues to run after the error.
Line 34 is this line:

$message, "From: $email" );

As I said before, I am very inexperienced in PHP (a complete beginner), so I do not understand why I am getting this error.

Any help will be very much appreciated.

Thank you.

Share this post


Link to post
Share on other sites

I'm afraid that link does not help, talks about using Googlemail.By the way, I forgot to mention: I am testing this program on my local machine, Using PHP 5.2 in conjunction with Apache server 2.2.Thanks.

Share this post


Link to post
Share on other sites

you need to setup php.ini file "smtp" (send mail transfer protocol) protocol. you can not send e-mail from your localhost computer, without connection to outside mail server. jlhalslip mentioned one way to setup smtp on your localmachine, by using google mail options as your default mail server. google mail is one of the fastest and largest mails, and i recomend you using the same. also if you have some host like trap18 you can also use their smpt details to setup your localhost mail connection.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.