Jump to content

[SOLVED] Mail form issue


Lambneck

Recommended Posts

I have a contact form that worked perfectly for a few months and then one day just stopped functioning. I was receiving mail through it and then it all of a sudden stopped. I didnt even notice it until recently when I tested it myself and nothing happened. I filled out the form and sent the message by did not receive the message in my mail box.

Does anyone know what might have happened? I heard about mail form hijacking before but if that was the case wouldn't I receive the spam mail along with everyone else on the spam list? I don't get it.  ???

 

Heres the form processor script Im using:

<?php

// Mail header removal
function remove_headers($string) 
{ 
$headers = array(
    "/to\:/i",
    "/from\:/i",
    "/bcc\:/i",
    "/cc\:/i",
    "/Content\-Transfer\-Encoding\:/i",
    "/Content\-Type\:/i",
    "/Mime\-Version\:/i" 
); 
  
if (preg_replace($headers, '', $string) == $string) 
	{
	return $string;
	} 

else 
	{
	die('Spam much?');
	}
}

// Build the email (replace the address in the $to section with your own)
$to = '[email protected]';
$subject = "New message: $subject";
$message = "$name said: $message";
$headers = "From: $email";


// field validation
if ($subject=="" || $message=="" || $name=="")
{
print ("All form fields are required. Please go back and try again.");
}

else 
{
// email validation
if(!eregi('^([._a-z0-9-]+[._a-z0-9-]*)@(([a-z0-9-]+\.)*([a-z0-9-]+)(\.[a-z]{2,3})?)$', $email)) 
{
print ("Your email address does not appear to be valid. Please go back and try again.");
exit;
}

// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);

// Redirect
header('Location: ../thanks.php');
}
?>

Link to comment
https://forums.phpfreaks.com/topic/161646-solved-mail-form-issue/
Share on other sites

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.