greens85 Posted February 10, 2009 Share Posted February 10, 2009 Hi all, I have a form to mail script that works just fine, the problem is I have no idea where to start in order to make it secure. I know that people can inject headers into the script to spam email accounts. What do I need to add to the code in order to stop this happening and gettin me barred from my host. This is the php code I'm using: <?php ini_set("sendmail_from", "[email protected]"); $to = "[email protected]"; $subject = "Customer Enquiry"; $name = $_POST ['name']; $email = $_POST['email']; $company = $_POST['company']; $telephone = $_POST['telephone']; $comments = $_POST['comments']; $reference = $_POST['reference']; '[email protected]'; $headers = "$name\n" . "$email\n" . "$company\n" . "$telephone\n" . "$comments\n" . "$reference\n" ; $sent = mail($to, $subject, $headers); ?> The following lines i was told to add by the host: ini_set("sendmail_from", "[email protected]"); '[email protected]'; Link to comment https://forums.phpfreaks.com/topic/144692-securing-form-to-mail-script/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.