Checker Php: Email

return $this->errors;

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

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. email checker php

checkdnsrr() caches results. Use dns_get_record() if you need raw, uncached data.

(more accurate)

public function getErrors(): array

return filter_var($email, FILTER_VALIDATE_EMAIL) !== false; // Usage $checker = new EmailChecker()

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