Jump to content

[SOLVED] My form stopped sending mail


mazman13

Recommended Posts

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");	

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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.