hi
this function:
function valid_email($email) {
will RETURN TRUE, if email looks good
will RETURN FALSE, if not looks like a good email STRING
<?php
// example how to use function
// Get STRING from <form method="POST"><input .....</form>
$email_posted = $_POST['user_email'];
$valid_mail = valid_email( $email_posted ); // Test
if( $valid_mail === true )
{ // $valid_mail Test was TRUE
echo 'Thank you. Your email address looks like be good!<br>
We will now send a message to your inbox.';
}
else
{ // $valid_mail Test was FALSE
// STOP .. must go back enter email again
exit( 'Please, Go back and enter a VALID email address, thank you' );
}
// HERE, put user email address into DATABASE
// and
// maybe send mail() to this contact, for example
exit(); // end script
?>