note 59661 deleted from function.mail by bjori
| From: | bjori@php.net | Date: | Tue, 05 Sep 2006 08:56:29 +0000 |
| Subject: | note 59661 deleted from function.mail by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-116684@lists.php.net to get a copy of this message | ||
Note Submitter: corretge at gmail dot com
----
A way to keep out spamers if in your form or script tell about From e-mail, and put it in the Header
is (if the variable name is email):
$emiliu = $_REQUEST['email'];
if ( preg_match ( "/^[-\w.]+@([A-z0-9][-A-z0-9]+\.)+[A-z]{2,4}$/", $emiliu) )
{
OK ... bla... bla.... bla
$mailHead = "From: " . $_REQUEST['email'];
mail($mailTO, $mailSbj, $mailBodyC . $mailBody, $mailHead);
}
else
{
BAD HEADER
}