Email — Checker Php ((new))

For 95% of applications, syntax + DNS validation is enough. Add disposable detection if you run a contest or free trial. Use SMTP mailbox verification only in offline jobs or if you fully understand the rate limits and anti-abuse policies of receiving mail servers.

private array $errors = []; public function check(string $email): bool email checker php

checkdnsrr() caches results. Use dns_get_record() if you need raw, uncached data. For 95% of applications, syntax + DNS validation is enough

Email addresses can have + , - , . , and even quoted strings. The built-in filter handles edge cases correctly. private array $errors = []; public function check(string

$domain = substr(strrchr($email, "@"), 1); $recipient = $email; // Get MX servers getmxrr($domain, $mxhosts); if (empty($mxhosts)) $mxhosts = [$domain];

// Usage $checker = new EmailChecker(); if ($checker->check("user@gmail.com")) echo "Email is valid."; else echo "Invalid: " . implode(", ", $checker->getErrors());