Validation is the process of determining if a value meets the acceptable criteria. Hygine is the process of correcting a value to meet the accepted criteria. The only hygine we do is removing of white spaces before and after an email. All other hygine should be done on the client side before submitting to the Emails or Subscribers service. Improperly formatted email addresses will be rejected with a 400 response.
We validate the case of emails, must be lower case, the syntax of the email and the top level domain (TLD).
The syntax and TLD validation are done using the Apache Commons validator.
Examples of valid Email address
- email@example.com, firstname.lastname@example.org, email@example.com
- firstname.lastname@example.org, email@example.com, firstname.lastname@example.org
- email@example.com, firstname.lastname@example.org
- email@example.com, firstname.lastname@example.org
Examples of invalid Email address
- subs – must contains “@” symbol
- subs@.com.my – tld can not start with dot “.”
- email@example.com – “.a” is not a valid tld, last tld must contains at least two characters
- subs123@.com – tld can not start with dot “.”
- subs123@.com.com – tld can not start with dot “.”
- .firstname.lastname@example.org – email’s first character can not start with dot “.”
- subs()*@gmail.com – email’s only allows character, digit, underscore and dash
- subs@%*.com – email’s tld only allows characters and digits
- subs..email@example.com – double dots “.” are not allow
- subs.@gmail.com – email’s last character can not end with dot “.”
- subs@firstname.lastname@example.org – double “@” is not allow
- email@example.com -email’s tld, which has two characters can not contain digits