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. [email protected])</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("[email protected]", "Mad Athletes Mail", $message, "From: $f_name $s_name <$email>");
header("Location:contact_us.php?sender=$f_name");	

Link to comment
https://forums.phpfreaks.com/topic/81496-solved-my-form-stopped-sending-mail/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.