I have a subscribe using the email button on my website. How do I restrict people subscribing using @gmail, @yahoo emails?
LIST EMAIL ADDRESS
$recipient = "test@test.com";
# SUBJECT (Subscribe/Remove)
$subject = "Subscribe";
# RESULT PAGE
$location = "https://test.com";
## FORM VALUES ##
# SENDER - WE ALSO USE THE RECIPIENT AS SENDER IN THIS SAMPLE
# DON'T INCLUDE UNFILTERED USER INPUT IN THE MAIL HEADER!
$sender = $recipient;
$email = $_POST[‘emailTextBox’];
if (!strpos($email, '@') || !strpos($email, '.')) {
echo "Email is invalid";
} else {
}
# MAIL BODY
$body .= "Email: ".$_REQUEST['Email']." \n";
# add more fields here if required
## SEND MESSGAE ##
mail( $recipient, $subject, $body, "From: $sender" ) or die ("Mail could not be sent.");
## SHOW RESULT PAGE ##
header( "Location: $location" );
?>