Heyzoos Posted June 5, 2008 Share Posted June 5, 2008 Hi, I've had the following form working great on a website and it would send the email with the data. A couple of days ago however, the form still accepts the information and goes to the 'thank you' page, yet now the email isn't coming through...??? Any ideas? Here's the code for the pages: On the form page: <form action="process.php" method="POST"> On the 'process' page: <?php include("global.inc.php"); $errors=0; $error="The following errors occured while processing your form input.<ul>"; pt_register('POST','name'); pt_register('POST','email'); pt_register('POST','S1'); pt_register('POST','Tour1'); pt_register('POST','T1'); pt_register('POST','Adults1'); pt_register('POST','FirstName'); pt_register('POST','SecondName'); pt_register('POST','Children1'); pt_register('POST','Children2'); pt_register('POST','Departure1'); pt_register('POST','Tour2'); pt_register('POST','T2'); pt_register('POST','Adults2'); pt_register('POST','FirstName2'); pt_register('POST','SecondName2'); pt_register('POST','Children21'); pt_register('POST','Children22'); pt_register('POST','Departure2'); pt_register('POST','Comments'); pt_register('POST','Cardtype'); pt_register('POST','Cardname'); pt_register('POST','Carddate'); pt_register('POST','Cardnumber'); pt_register('POST','Howfound'); if($email=="" ){ $errors=1; $error.="<li>Please fill in your email address."; } if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$email)){ $error.="<li>Invalid email address entered"; $errors=1; } if($errors==1) echo $error; else{ $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/")); $message="Name: ".$name." Email: ".$email." Pickup Address and Phone Number: ".$S1." 1st Tour: ".$Tour1." Options: ".$T1." Number of Adults: ".$Adults1." Name of 1st Adult: ".$FirstName." Name of 2nd Adult: ".$SecondName." Number of Children: ".$Children1." Names and Ages: ".$Children2." Departure Date: ".$Departure1." 2nd Tour: ".$Tour2." Options: ".$T2." Number of Adults: ".$Adults2." Name of 1st Adult: ".$FirstName2." Name of 2nd Adult: ".$SecondName2." Number of Children: ".$Children21." Names and Ages: ".$Children22." Departure Date: ".$Departure2." Comments: ".$Comments." Credit Cart Type: ".$Cardtype." Card Holder Name: ".$Cardname." Expiry Date: ".$Carddate." Card Number: ".$Cardnumber." How they found the website: ".$Howfound." "; $message = stripslashes($message); mail("sales@mydomain.com","New Booking!",$message,"From: Online Booking Received"); header("Refresh: 0;url=http://www.mydomain.com/thanks.html"); ?><?php } ?> On the 'global' page: <?php function pt_register() { $num_args = func_num_args(); $vars = array(); if ($num_args >= 2) { $method = strtoupper(func_get_arg(0)); if (($method != 'SESSION') && ($method != 'GET') && ($method != 'POST') && ($method != 'SERVER') && ($method != 'COOKIE') && ($method != 'ENV')) { die('The first argument of pt_register must be one of the following: GET, POST, SESSION, SERVER, COOKIE, or ENV'); } $varname = "HTTP_{$method}_VARS"; global ${$varname}; for ($i = 1; $i < $num_args; $i++) { $parameter = func_get_arg($i); if (isset(${$varname}[$parameter])) { global $$parameter; $$parameter = ${$varname}[$parameter]; } } } else { die('You must specify at least two arguments'); } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/ Share on other sites More sharing options...
LooieENG Posted June 5, 2008 Share Posted June 5, 2008 Have you tried just <?php mail('email@domain.com', 'test', 'test'); ?> If it doesn't work, it's probably a problem with the server Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558706 Share on other sites More sharing options...
Heyzoos Posted June 5, 2008 Author Share Posted June 5, 2008 Hi, Thanks for that, yet it also doesn't work. I've contacted the host and they say everything is fine on their end...??? Would/could there be an issue with SMTP? Just a thought. Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558723 Share on other sites More sharing options...
MatthewJ Posted June 5, 2008 Share Posted June 5, 2008 have you tried sending to mulitiple addresses? I hit my head against the wall for about a week once thinking the code/server etc. was messed up, only to find out my isp had instituted a new spam filter that was catching it... Just a thought. Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558746 Share on other sites More sharing options...
Heyzoos Posted June 5, 2008 Author Share Posted June 5, 2008 Great idea...however just tried a few different email accounts from different servers and no luck ??? Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558755 Share on other sites More sharing options...
haku Posted June 6, 2008 Share Posted June 6, 2008 Someone had the right idea in checking to see if it was mailing, but the code didn't give a response to whether or not the mail was actually sent. Try this and tell us what the output is: <?php echo (mail('email@domain.com', 'test', 'test')) ? "mail was sent" : "mail wasn't sent"; ?> (note: change email@domain.com to a real address) Come back here and tell us what was displayed to the screen. Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558890 Share on other sites More sharing options...
Heyzoos Posted June 6, 2008 Author Share Posted June 6, 2008 Hi, Just tried it and received: mail wasn't sent Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558899 Share on other sites More sharing options...
Buddski Posted June 6, 2008 Share Posted June 6, 2008 Is it possible that your host has changed a setting which is disabling the mail() function..Just a thought. Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558907 Share on other sites More sharing options...
Heyzoos Posted June 6, 2008 Author Share Posted June 6, 2008 not that i'm aware of...i just contacted their support department in regards to this, so hopefully will hear back soon...any other fix ideas? anyone? haku? Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558909 Share on other sites More sharing options...
haku Posted June 6, 2008 Share Posted June 6, 2008 If you ran that script exactly as I showed, with nothing else in other than what I showed, using a valid email address and not the one I showed, then there is a problem with your host. While the mail sent by that script may get filtered by junk mail filters, it should go out with no troubles at all. Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-558928 Share on other sites More sharing options...
Heyzoos Posted June 6, 2008 Author Share Posted June 6, 2008 Just heard back from the hosting company, and yep, it was on their end. Don't really understand why they 'turn things off', but hats off to all for your assistance with this! Quote Link to comment https://forums.phpfreaks.com/topic/108907-solved-form-working-yet-email-isnt-received/#findComment-559437 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.