Email addresses syntax validations library
Syntax email addresses verification based on RFC5321 and RFC5322. Version 2 is full remake of original one using TypeScript. Now it's a class with one static method "validate". Library can be used in Node.js back-end and in Angular 4 front-end projects.
Install Email Syntax as an npm module and save it to your package.json file as a dependency:
npm install --save email-syntax
Usage of validator is simple as 2 + 2. You need to import class and then use its "validate()" method.
const EmailSyntax = EmailSyntax;if EmailSyntaxconsole;
On server environment you can use additional methods:
- split(address) - Splits email address to local part and domain name
- extractFromQuotes(localPart) - Checks if quoted and extracts local part
- validateDomainName(domainName) - Validates domain name syntaxis
- validateLocalPart(localPart) - Validates local-part of address
- isValidIpAddress(domainName) - Checks if domain name is a valid ip address like 18.104.22.168