Struggling to create a function to validate any email address using the script below
if (!preg_match('/^(?=^.{6,64}$)[a-zA-Z0-9][a-zA-Z0-9\._\-&!?=#]*@/', $user_mail)) {
$error_mail = empty_mail;
$display_form = TRUE;
$validation_error = TRUE;
} else {
$domain = preg_replace('/^[a-zA-Z0-9][a-zA-Z0-9\._\-&!?=#]*@/', '', $user_mail);
if (!checkdnsrr($domain)) {
$error_mail = empty_mail;
$display_form = TRUE;
$validation_error = TRUE;
}
}