Validates email addresses according to RFC 5322 standards.
This validation performs comprehensive email format checking to ensure that email addresses meet technical specifications and common usage patterns. It validates both the local part (before @) and domain part (after @) of email addresses, enforcing length limits, character restrictions, and structural requirements.
The validation checks include: empty string detection, space character prohibition, @ symbol presence and uniqueness, maximum length constraints (254 total, 64 for local part), and full RFC 5322 regex pattern matching. The regex supports quoted strings, IP addresses in brackets, and internationalized domain names.
The validation is case-insensitive and trims whitespace before processing. It can
be configured to validate any field through the :field option, defaulting to the
:email attribute. Nil values are considered valid to allow optional email fields.
Summary
Functions
Validates an email address field in the changeset.