how can i "security" to my mail.php

I am really new to anything.php What is the best way to make sure my form is not used to spam or really for anything other than sending valid info?

<?php $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $category = $_POST['category']; $message = $_POST['message']; $formcontent="From: $name \n Email: $email \n Subject: $subject \n Category: $category \n message: $message"; $recipient = "[email protected]"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!"; ?>

Security for emails or contact-us pages vary in many ways. One way that a lot of sites use is to place a
field on the page that says “Erase this line”. Place that text in a line next to the submit button. The user
must erase it before they can send the email. This will stop robots because they will not empty the field.
Instead most robots fill in every field on a page.

Another way is to use Captcha codes. Code for that can be found all over the net. Just Google it…
This type of code forces the user to type in a secret number which forces them to look at a graphic and
read the numbers hidden in it.

You can also keep a list of IP addresses of the sites that send emails to you and ban them. This can be a bit
tricky because it is fairly easy to hide an IP address. (You need code that looks behind proxy servers to get
their real IP addresses. This code is available, too.)

Well, some ideas for you to start with… Good luck!

Sponsor our Newsletter | Privacy Policy | Terms of Service