Email Checker: Php

return filter_var($email, FILTER_VALIDATE_EMAIL) !== false;

$domain = substr(strrchr($email, "@"), 1); $disposableDomains = [ 'mailinator.com', 'guerrillamail.com', '10minutemail.com', 'tempmail.com', 'throwawaymail.com', 'yopmail.com' // Keep this list updated – or fetch from a remote source ]; return in_array($domain, $disposableDomains); email checker php

private function isDisposable(string $domain): bool return filter_var($email, FILTER_VALIDATE_EMAIL)

var_dump(isSyntaxValid("john.doe+spam@gmail.com")); // true var_dump(isSyntaxValid("john..doe@gmail.com")); // false (double dot) Syntax passes, but the domain must exist and accept email. FILTER_VALIDATE_EMAIL) !== false

$domain = substr(strrchr($email, "@"), 1); $freeProviders = [ 'gmail.com', 'yahoo.com', 'outlook.com', 'hotmail.com', 'aol.com', 'protonmail.com', 'mail.com', 'gmx.com' ]; return in_array($domain, $freeProviders);

Email addresses can have + , - , . , and even quoted strings. The built-in filter handles edge cases correctly.

function isSyntaxValid(string $email): bool