Jump to content

NEED HELP!! my php form is being used to send spam


redgtsviper

Recommended Posts

I am using the following code to send form content to my email address. I am having problems with spam. What can I do to fix this problem. I would like to avoid image varification. Any code would be very helpful. I am new to PHP

<?php

$msg = "My Website Online Contact Submission\n";

$msg .= "Name: $name\n";
$msg .= "Comments: $emailAddress\n\n";
$msg .= "Comments: $phone\n\n";
$msg .= "Comments: $message\n\n";





$to = "me@mydomain.com";
$subject = "CONTACT FROM WEBSITE";
$mailheaders = "From: Website Submission Form <$emailAddress>\n";
$mailheaders .= "Reply-To:$Email_Address <$emailAddress>\n\n";
// Mail to address
mail ( $to, $subject, $msg, $mailheaders );

?>
Link to comment
Share on other sites

Image verification is the way to go, but if you don't want to do that, you can code your own filter if the spam is consistent. For instance, have the script fail if the phone number field contains anything other than numbers, parenthesis, periods, or dashes with an explaination of why it wasn't accepted (spammers are typically bots, not humans as far as I know, and will not make sense of it). Likewise you could have the email field verified (must contain @ symbol and .com or .net or etc...). Finally, if your spam has a consistent subject matter you can block messages that use certain keywords like 'enlarge' or 'prescriptions'. Again, I would recommend a notification message if the sending fails on the off chance that it is an actual customer who is trying to message you.

[!--quoteo(post=349889:date=Feb 27 2006, 11:13 AM:name=Charles Andrews)--][div class=\'quotetop\']QUOTE(Charles Andrews @ Feb 27 2006, 11:13 AM) [snapback]349889[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I am using the following code to send form content to my email address. I am having problems with spam. What can I do to fix this problem. I would like to avoid image varification. Any code would be very helpful. I am new to PHP

<?php

$msg = "My Website Online Contact Submission\n";

$msg .= "Name: $name\n";
$msg .= "Comments: $emailAddress\n\n";
$msg .= "Comments: $phone\n\n";
$msg .= "Comments: $message\n\n";
$to = "me@mydomain.com";
$subject = "CONTACT FROM WEBSITE";
$mailheaders = "From: Website Submission Form <$emailAddress>\n";
$mailheaders .= "Reply-To:$Email_Address <$emailAddress>\n\n";
// Mail to address
mail ( $to, $subject, $msg, $mailheaders );

?>
[/quote]
Link to comment
Share on other sites

you could make it only alow one message to be sent every 5 mins... i will find some code that would help.

<?php
session_start();
if ($_SESSION['wait'] == '1'){
die("You may not send an email too often");
}
$msg = "My Website Online Contact Submission\n";

$msg .= "Name: $name\n";
$msg .= "Comments: $emailAddress\n\n";
$msg .= "Comments: $phone\n\n";
$msg .= "Comments: $message\n\n";
$to = "me@mydomain.com";
$subject = "CONTACT FROM WEBSITE";
$mailheaders = "From: Website Submission Form <$emailAddress>\n";
$mailheaders .= "Reply-To:$Email_Address <$emailAddress>\n\n";
// Mail to address
mail ( $to, $subject, $msg, $mailheaders );
$_SESSION['wait']='1'
?>

although it uses sessions, it will still do the job. it will only let you send an email after 5 mins or so.
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.