EmailValidator
EmailValidator
Section titled “EmailValidator”Use EmailValidator for account, contact, and notification addresses.
Create a rule
Section titled “Create a rule”Rule::email(string $field): EmailValidatorMethods
Section titled “Methods”| Method | Description |
|---|---|
length(int $min, int $max) | Configure the accepted email length. |
verifyDomain(bool $enabled = true) | Enable MX-record verification. |
required(bool $required = true) | Mark the field as required. |
optional() | Allow a missing email. |
validateField(mixed $value) | Return the first error or null. |
validateFieldAll(mixed $value) | Return every applicable error. |
Example
Section titled “Example”use Fynix\Rule;
$validator = Rule::email('email') ->length(6, 180) ->verifyDomain();
$error = $validator->validateField('person@example.com');Syntax checks are always enabled. Domain verification is opt-in because DNS lookups add network cost and can make validation less deterministic.