Home > @opengovsg/validators > EmailValidatorOptions > domains
EmailValidatorOptions.domains property
The list of allowed domains for the domain part of the email address. If not provided, all domains are allowed.
Each whitelisted domain must be specified as an object with the domain and includeSubdomains properties. By default, includeSubdomains is false, meaning only the exact domain is allowed. If includeSubdomains is true, all subdomains of the domain are also allowed.
Signature:
typescript
domains?: {
domain: string;
includeSubdomains?: boolean;
}[];Example
javascript
[ { domain: 'gov.sg', includeSubdomains: true } ]This will allow gov.sg and all subdomains of gov.sg, such as open.gov.sg.