Path:
/src/type/email.coffee
compiled to/lib/type/email.js
There are a lot of crazy possibilities in the RFC2822 which specifies the Email format. Perhaps it came from letting different existing email systems represented their account, to encompass anything that was valid before.
So this check will not aim to allow all emails allowed through RFC but only those which are reasonable and commonly used.
Sanitize options:
lowerCase
domain and gmail addresses completelynormalize
Boolean
remove tags, alternative domains and subdomains
Check options:
checkServer
-Boolean
also check for working email serversdenyBlacklisted
-Boolean
deny all mail servers which are currently blacklisteddenyGraylistes
-Boolean
deny all mail servers which are on the untrusted lists (graylists)
Schema Specification
Email is an email schema definition.
An object with the following keys allowed: lowerCase
, normalize
, checkServer
, denyBlacklisted
, denyGraylistes
, title
, description
, key
, type
, optional
, default
. The following entries have a specific format:
lowerCase
-
Lower Case is a flag to transform to lower case letters.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
normalize
-
Normalize is a flag to normalize some common email address variants to their base.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
checkServer
-
Check Server is a flag to also check the MX record of the destination host if possible.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
denyBlacklisted
-
Deny Blacklisted Server is a flag to deny all mail addresses of servers which are currently on any blacklist.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
denyGraylistes
-
Deny Graylistes Server is a flag to deny also mail addresses of untrusted servers which users are unverified.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
title
-
Title is the title used to describe the element.
A text entry which is optional. All control characters will be removed.
description
-
Description is the free description of the element.
A text entry which is optional. All control characters will be removed.
key
-
Binding to Keyname is the mapping to which key names in an object this element belongs.
A valid regular expression which is optional. It has to be one of the following types:
- An object which has to be an instance of class
RegExp
. - A text entry in which all control characters will be removed. The text should match: /^/.?/[gim]$/.
- An object which has to be an instance of class
type
-
Type is the type of element.
A text entry in which all control characters will be removed.
optional
-
Optional is a flag defining if this element is optional.
A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.
default
-
Default Value is the default value to use if nothing given.
A text entry which is optional. All control characters will be removed. It has to be at least 5 characters long.