Page 1 of 1

email me back form error !!

Posted: Tue Jul 07, 2009 5:06 am
by swarnpalsingh89
i have been trying to use this script to send me an email from my website , i used to work before , but it isnt working now , please help !!!
link to html page is http://www.vttravels.in/railnew.html

PLEASE HELP !!!

PHP SCRIPT :

<?php




$email = 'swarnpalsingh89@hotmail.com';

$subject = 'Railway Registeration';

$emailcheck = $_REQUEST['email'];

$message = "FROM : ".$_REQUEST['from']."\nTO : ".$_REQUEST['to1']."\nDATE : ".$_REQUEST['date1x']."\nAPPROX TIME : ".$_REQUEST['hrs']." ".$_REQUEST['mins']." ".$_REQUEST['meridian']."\nCLASS : ".$_REQUEST['class']."\nNO. OF TICKET : ".$_REQUEST['no_of_ticket']."\nDESCRIPTION : ".$_REQUEST['description']."\nNAME : ".$_REQUEST['name']."\nEMAIL : ".$emailcheck."\nPHONE : ".$_REQUEST['phone']."\nFAX : ".$_REQUEST['fax']."\nADDRESS : ".$_REQUEST['street']."\nCITY or STATE : ".$_REQUEST['city']."\nZIP : ".$_REQUEST['zip']."\nCountry : ".$_REQUEST['country'];



/* PHP form validation: the script checks that the Email field contains a valid email address and the Subject field isn't empty. preg_match performs a regular expression match. It's a very powerful PHP function to validate form fields and other strings - see PHP manual for details. */

if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/", $emailcheck)) {

echo "<h4>Invalid email address</h4>";

echo "<a href='javascript:history.back(1);'>Back</a>";

} elseif ($subject == "") {

echo "<h4>No subject</h4>";

echo "<a href='javascript:history.back(1);'>Back</a>";

}



/* Sends the mail and outputs the "Thank you" string if the mail is successfully sent, or the error string otherwise. */

elseif (mail($email,$subject,$message)) {

echo "<h4>Thank you for sending email, Our representative will soon get in contact with you</h4>";

} else {

echo "<h4>Can't send email to $email</h4>";

}

?>

Re: email me back form error !!

Posted: Tue Jul 07, 2009 10:30 am
by Jammerious
Hi,
exactly what seems to be the problem? You are not getting emails? Check your apache log file to see which error occurs.

Re: email me back form error !!

Posted: Tue Jul 07, 2009 11:55 pm
by swarnpalsingh89
there is no error , the php script displays that it has sent the email , but i dont get it

Re: email me back form error !!

Posted: Wed Jul 08, 2009 4:41 am
by swarnpalsingh89
ok , i tried the same script on my friends server , there it worked fine , i guess i have to configure my server in some way , can u help me with that .

Re: email me back form error !!

Posted: Wed Jul 08, 2009 5:23 am
by Jammerious
You should google for instructions on how to set up sendmail (or whichever mailing agent you have) on your server configuration.
If you want someone here to help you need to be more "verbose" about your problem, like what server configuration you have.
You said there was no error, but I am not sure if you understood where to look: find your web server (ie. apache) error log file, it is sure to have something about this problem there. Google is your friend :)