Hi.
I want to create a simple web form in order to allow visitors to send me their comments via
email. I created this code:
$to = "mybox@mydomain.com";
$subject = "Comments from the web";
$body = "Comments:\n";
$body = $body . "----------------------- \n";
$body = $body . $email . "\n";
$body = $body . "----------------------- \n";
$body = $body . $name . "\n";
$body = $body . "----------------------- \n";
$body = $body . $text . "\n";
$headers = "From: $email";
mail($to,$subject,$body,$headers);
'$email' is the email address of the visitor, '$name' is their name, and '$text'
is the contents of the comments.
But I found out that some spammers used this form to send spam. I didn't make any
filter of the contents, and I was suggested they were using script injection within
the form.
Do you know any more-secure web form for sending emails? Thank you very much.