mazman13 Posted December 13, 2007 Share Posted December 13, 2007 Anyone have any ideas why a form that I had set up just stopped sending mail? Could it be the server? It's going through mdwebhosting.com.au and using CPANEL. Here is the sample form $f_name = $_REQUEST['f_name']; $email = $_REQUEST['email']; $phone = $_REQUEST['phone']; if ($f_name == "") { $error = "Please enter your first name."; header("Location:contact_us.php?f_name=$f_name&email=$email&comm=$comm&phone=$phone&w_phone=$w_phone&m_phone=$m_phone&date=$date&fa_name=$fa_name&m_name=$m_name&address=$address&postcode=$postcode&gender=$gender&s_name=$s_name&suburb=$suburb&day=$day&month=$month&error=$error"); exit(); }; if ($email == "") { $error = "Please enter your e-mail address."; header("Location:contact_us.php?f_name=$f_name&email=$email&comm=$comm&phone=$phone&w_phone=$w_phone&m_phone=$m_phone&date=$date&fa_name=$fa_name&m_name=$m_name&address=$address&postcode=$postcode&gender=$gender&s_name=$s_name&suburb=$suburb&day=$day&month=$month&error=$error"); exit(); }; if (!ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$",$email)) { $error = "Please enter your e-mail in correct format<br><i>(i.e. yourname@domain.com)</i>."; header("Location:contact_us.php?f_name=$f_name&email=$email&comm=$comm&phone=$phone&w_phone=$w_phone&m_phone=$m_phone&date=$date&fa_name=$fa_name&m_name=$m_name&address=$address&postcode=$postcode&gender=$gender&s_name=$s_name&suburb=$suburb&day=$day&month=$month&error=$error"); exit(); }; if ($phone == "") { $error = "Please enter your phone number."; header("Location:contact_us.php?f_name=$f_name&email=$email&comm=$comm&phone=$phone&w_phone=$w_phone&m_phone=$m_phone&date=$date&fa_name=$fa_name&m_name=$m_name&address=$address&postcode=$postcode&gender=$gender&s_name=$s_name&suburb=$suburb&day=$day&month=$month&error=$error"); exit(); } $message = "Name: $f_name $s_name \nAddress: $address\nSuburb: $suburb $postcode\nPhone: $phone\nE-mail: $email\nWork: $w_phone\nMobile: $m_phone\n\nGender: $gender\nDate of Birth: $day/$month/$date\nFather's Name: $fa_name\nMother's Name: $m_name\n\nComments or Questions:\n$comm"; mail("michaelzavala@gmail.com", "Mad Athletes Mail", $message, "From: $f_name $s_name <$email>"); header("Location:contact_us.php?sender=$f_name"); Quote Link to comment Share on other sites More sharing options...
themistral Posted December 13, 2007 Share Posted December 13, 2007 If it was working OK and you have not touched the script then yes, I would check with your hosts to see if they have made any server configuration changes before doing anything else - and check if they are having any problems! Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2007 Share Posted December 13, 2007 The posted code is putting the $f_name and $s_name variables directly into the header field without validating what they contain. It is possible that a spammer has been sending through your form processing code and has gotten your mail server banned. It is also possible that if the domain in the From: address is @gmail.com that gmail is rejecting the emails because your mail server is not authorized to send email for gmail. You should actually put the user entered email address into the Reply-to: header (after you validate it to insure it does not contain spam content or additional headers) and put a valid email address hosted by your mail server into the From: header. You should also check your domain at www.dnsreport.com to make sure there are not any DNS errors that would get email from your server discarded or placed into the junk/spam folder at the receiving mail server. Quote Link to comment 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.