Email Checker — Php

function isFreeEmailProvider(string $email): bool

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

function isMailboxValid(string $email, int $timeout = 5): bool email checker php

public function getErrors(): array

return $this->errors;

$this->errors = []; // Level 1: Syntax if (!filter_var($email, FILTER_VALIDATE_EMAIL)) $this->errors[] = "Invalid email format"; return false; // Level 2: Domain exists $domain = substr(strrchr($email, "@"), 1); if (!checkdnsrr($domain, "MX") && !checkdnsrr($domain, "A")) $this->errors[] = "Domain does not accept email"; return false; // Level 3: Disposable check (optional – depends on your use case) if ($this->isDisposable($domain)) $this->errors[] = "Disposable email addresses not allowed"; return false; // Level 4: SMTP check (optional – use carefully) // if (!$this->smtpCheck($email)) // $this->errors[] = "Mailbox does not exist"; // return false; // return true;

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

function isDomainValid(string $email): bool checkdnsrr($domain, "A");