* Validates email syntax using RFC 5322 compliant regex
(email: string)
| 42 | * Validates email syntax using RFC 5322 compliant regex |
| 43 | */ |
| 44 | function validateEmailSyntax(email: string): boolean { |
| 45 | const emailRegex = |
| 46 | /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ |
| 47 | return emailRegex.test(email) && email.length <= 254 |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Checks if email is from a known disposable email provider |
no test coverage detected