addy-0.1.0.0: A full-featured library for parsing, validating, and rendering email addresses

Copyright This file is part of the package addy. It is subject to the licenseterms in the LICENSE file found in the top-level directory of thisdistribution and at:https://code.devalot.com/open/addyNo part of this package including this file may be copiedmodified propagated or distributed except according to the termscontained in the LICENSE file. BSD-2-Clause None Haskell2010

Addy.Internal.Validation

Description

Internal data validation functions.

Synopsis

# Documentation

Validate a single host name. Each host name in a domain name (referred to as a label) must validate with this function.

RFC 2181 §11 clearly states that there are no restrictions placed on which characters may appear in a label. However, due to legacy issues we enforce the rule from RFC 952 §1 that disallows hyphens as the first or last character of a label.

RFC 5322 §3.4.1 restricts the characters that may appear in the domain component of an email address. Even though a DNS label does not impose such restrictions, in order to be a valid email address the label must only be composed of so-called atext characters or UTF8-non-ascii characters.

Finally, RFC 2181 §11 restricts the length of a label to 63 bytes and the fully-qualified domain name to 255 bytes. RFC 6532 which extends the email syntax to allow UTF-8 encoded Unicode characters briefly states in §3.4 to continue using bytes, and not characters. It also states that Unicode text should be normalized (which we do).

Since: 0.1.0.0

Validate a domain name.

The domain name is split into host names (labels) and each label is validated with validateHostName.

Since: 0.1.0.0

Validate and normalize the text content of the LocalPart of an email address.

RFC 3696 §3 restricts the length of the local part to a maximum of 64 bytes. RFC 6532 extends the character set to include Unicode characters but maintains the length measurement as bytes and not characters.

Since: 0.1.0.0

Validate the content of a DisplayName.

There does not appear to be a limit on the length of the display name. For consistency and efficiency we limit it to 64 bytes, the same as the local part.

Since: 0.1.0.0

Validate the Literal content of a domain literal.

There does not appear to be a limit on the length of an address literal but for consistency with DNS labels we limit them to 63 bytes.

Since: 0.1.0.0

Validate the content of an AddressTag. Uses the same rules as validateLiteral.

Since: 0.1.0.0

Validate the content of a comment.

There does not appear to be a limit on the length of a comment. For consistency and efficiency we limit it to 64 bytes, the same as the local part.

Since: 0.1.0.0

Validate an entire EmailAddr. This is used by the parser to validate rules that are not encoded in the various component parsers.

Since: 0.1.0.0