i have read some documents about email validations where i cant find now in this forum,
i have this 3 functions
Code: Select all
function validate_email($emailfrom) {
return preg_match("/^([0-9a-zA-Z]([-.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+[a-zA-Z]{2,9})$/",$emailfrom);
}
function has_no_emailheaders($emailfrom) {
return preg_match("/(%0A|%0D|\n+|\r+)(content-type:|to:|cc:|bcc:)/i", $emailfrom);
}
function has_no_newlines($emailfrom) {
return preg_match("/(%0A|%0D|\n+|\r+)/i", $emailfrom);
}$_POST['email'] = "mail@mail.com"; // its what is being posted
echo "1".$obj_mail->validate_email($_POST['email']);
echo "2".$obj_mail->has_no_emailheaders($_POST['email']);
echo "3".$obj_mail->has_no_newlines($_POST['email']);
the result is always 0 in the 3 functions, its expcted the first function return 1 where it matches... ??? but anyway if i try to put \n or cc in the email all 3 functions returns 0 allways... and should return 1 in case the is a match right ??