Skip to main content

email

Validate that a string is a syntactically valid email address (RFC 5322 compliant).

Signature

NguardValidators.String.email: ValidatorFn

A parameterless validator — used directly without invocation.

Reactive forms

import { FormControl } from '@angular/forms';
import { NguardValidators } from 'ng-nguard';

const email = new FormControl('', [NguardValidators.String.email]);

Template-driven forms

<input ngModel name="email" type="email" nguardEmail />

Error key

{ email: true }

Notes

  • Validates syntax, not deliverability — someone@nonexistent.example passes the regex but won't receive mail.
  • Empty strings fail.
  • Use a server-side reachability check for true verification (e.g. an Async validator hitting an SMTP probe).

See also

  • url — sibling format check for URLs
  • regex — for custom email shapes (e.g. corporate domain only)