Email Address test cases


I've been on many teams in my whole testing career, and for some reason, I always end up getting assigned to validate the email address field.  So after numerous times of hunting down my old email test cases from previous team, I am giving up.  I thought I am just going to list out all of them here out on the internet.  I know that I probably going to have to refer to this list again and again in the future.  Might as well help benefit others like me.

Here is the list of valid and invalid email format which can be used for testing.  The list is not comprehensive by any means, and is probably missing a bunch of edge cases.  However, it provides enough coverage for the majority of the allowed/disallowed email address according to RFC 2822.

BTW, if anyone else would like to contribute more cases to this list, or spot errors (fingers crossed), please feel free to let me know and I'll make sure the list is up-to-date.

Valid Email address Reason
email@domain.com Valid email
firstname.lastname@domain.com Email contains dot in the address field
email@subdomain.domain.com Email contains dot with subdomain
firstname+lastname@domain.com Plus sign is considered valid character
email@123.123.123.123 Domain is valid IP address
email@[123.123.123.123] Square bracket around IP address is considered valid
"email"@domain.com Quotes around email is considered valid
1234567890@domain.com Digits in address are valid
email@domain-one.com Dash in domain name is valid
_______@domain.com Underscore in the address field is valid
email@domain.name .name is valid Top Level Domain name
email@domain.co.jp Dot in Top Level Domain name also considered valid (use co.jp as example here)
firstname-lastname@domain.com Dash in address field is valid

 

Invalid Email address Reason
plainaddress Missing @ sign and domain
#@%^%#$@#$@#.com Garbage
@domain.com Missing username
Joe Smith <email@domain.com> Encoded html within email is invalid
email.domain.com Missing @
email@domain@domain.com Two @ sign
.email@domain.com Leading dot in address is not allowed
email.@domain.com Trailing dot in address is not allowed
email..email@domain.com Multiple dots
あいうえお@domain.com Unicode char as address
email@domain.com (Joe Smith) Text followed email is not allowed
email@domain Missing top level domain (.com/.net/.org/etc)
email@-domain.com Leading dash in front of domain is invalid
email@domain.web .web is not a valid top level domain
email@111.222.333.44444 Invalid IP format
email@domain..com Multiple dot in the domain portion is invalid

 

 


Contributors

List of people who help contribute to help solidify the cases

gabriel.lozano-moran

bernie halpin

Avdhut

Comments (45)

  1. gabriel.lozano-moran says:

    You forget 4 letter TLD’s. Like .name … I am saying this because often my email address does not get validated.

  2. Valid email address:

    firstname-lastname@domain.com — dash in username is valid (e.g. is valid for Windows Live ID).

  3. ch4n says:

    Many thanks to both of you @gabriel.lozano-moran and @bernie halpin

    I have added more valid cases into the list above.

    Social test casing at its best.  🙂

  4. Avdhut says:

    Hay Chan,

    Is there any validation for the limit of numbers of dots present in the email domain?

    Thanks,

    Avdhut

  5. ch4n says:

    Hi Avdhut,

    Thanks for pointing this out.  RFC 2822 defines the "dot-atom" to be single unit for the part that makes up the domain.  I am adding another case into the invalid cases to have this explicit.

    Thanks,

    Chan

  6. Ganesh Kumar. M says:

    It is very useful for me——- Thanks

  7. Steve says:

    I took over some unimpressive code that mostly worked. That said, the one thing that didn’t work were email inputs like this:

    Email: me@home.com, me@work.com

    That is, two valid email addresses in one email input; usually this is bad.

  8. Sandhya says:

    It was very useful especially the invalid ones.Thanks

  9. NANDHU says:

    Hi Pals,

    I am very very happy and impresses by seeing these comments and blogs regarding testing , and i would like to request you people to give a bit information regarding "URL" validations ,which can help me in my testing life.

    Email : nandhu28@ymail.com

    Regards,

    Nandhu

  10. ethies says:

    what above mentioned are common for all email promoters?

  11. Tester says:

    According to RFC 5322 Single quotes are valid for the first part of the email address, but many web applications fail this test even though it is quite common in corporate mail systems.

    ie.   Jim.O’Shea@domain.com

  12. rallyrace says:

    Can u give me calendar test case

  13. Pratiksha Jadhav says:

    Whether this Email ID : email@123.123.123.123  

    Is valid?

    I've checked for the above one, it is showing INVALID email ID.

  14. Pratiksha Jadhav says:

    Hi,

    I've checked for this email id : あいうえお@domain.com  – Unicode char as address

    If the DB is having Unicode char support, it is accepted.

    If I'm wrong correct me…

    Thanks,

    Pratiksha

  15. Henry Ayoola says:

    email@domain.museum

    Reason: 6-letter TLD is valid.

  16. Yaounde says:

    Your Blog is one of the best top 100 software testing blogs listed in this article:

    http://www.testingminded.com/…/top-100-software-testing-blogs.html

    but for me, it's just one of the best! Keep the great work!

    ——————

    If you plan to go in Cameroon, please visit: <a href="offres-d-emploi-au-cameroun.blogspot.com/">Offres d'emploi au Cameroun</a>

  17. Shailendra says:

    shail@gmail.com.    is a Invalid ID  !

  18. Danny Keton says:

    Useful and concise.  Thanks for sharing!

  19. Ramesh Yampalla says:

    It was really help for unknown persons…..Thanks a lot….

  20. email@111.222.333.44444 is invalid but for different reason than given says:

    The reasoning given in the table is that it is not a valid IP address – true, but it is valid domain address if you do not include TLD testing – 44444 is not a valid top level domain, otherwise this address would be valid.

  21. Vik says:

    some other invalid email ids'

    email@domain.

    email@.domain

  22. Rajesh says:

    Very nice test cases for valid and invalid Email Address

  23. Divya says:

    _______@domain.com

    Is This Really Valid Email Address???????????

  24. Rick says:

    ".web is not a valid top level domain"

    it can be, and it might be in the future and its still a valid email address if you use it.

  25. Jules says:

    Your invalid table states: "email@domain.com (Joe Smith) Text followed email is not allowed" but I don't think this is right. RFC2822 defines an address as 'local-part "@" domain', where domain is defined as one of several forms including 'dot-atom', and dot-atom is defined as '[CFWS] dot-atom-text [CFWS]'.  CFWS is "comment folding white space", i.e. whitespace that may include newlines and comments.  A comment is '(' followed by any ASCII characters other than ')', then ')'.  The address you quote follows these rules.

  26. ASHWIN KARANGUTKAR says:

    (Space)Firstname@domain.com

    Reason : space not allowed.

    Thank you.

  27. Farrukh Shahzad Ahmed says:

    This is amazing sharing. Thank you very much

  28. Dhaval Panchal says:

    Can anyone tell me the Regular Expression validation to validate all above emails?

  29. Anil says:

    According to my email id containing between two words is also invalid

    Eg.

    Anil gupta@gmail.com is invalid email id

    correct me if i am wrong.

  30. Denys says:

    The Internet email message format is now defined by RFC 5322

    en.wikipedia.org/…/RFC_2822

  31. Vishruth says:

    Hey,

    I guess  あいうえお@domain.com is valid email id.

    Please refer the below link

    en.wikipedia.org/…/International_email

    tools.ietf.org/…/rfc5335

  32. Gaurav says:

    It's really useful notes while testing any forms having email address.

  33. Shahid Algur says:

    Simply fabulous.  Thanx for providing such info.

  34. shahnawazhkbk@gmail.com says:

    It is very useful for me both test case valid and invalid – Thank you

  35. Mohammed Zaheer Saddapali says:

    Regular Expression for the above scenario

    var re = /^w+([.-]?w+)*@w+([.-]?w+)*(.w{2,3})+$/;

    http://jsfiddle.net/AkuXC/403/

  36. Edwin says:

    Any one can confirm is this is valid or invalid email address

    test@live.com.sad.as.das.d.sad.as.dsa.d.as.d.asd.asd

  37. RGS says:

    Hi Chan ,

    I came across online email/domain validation URL are accepting gg@gg.ZZZZ.com and email ids like this combination. Even online E-commerce sites are accepting this id. if sign up with this id you can directly get signed up. Do you have any idea regarding this ?

  38. shubhra says:

    You can also add test cases below:

    Valid: email (comment)@domain.com

    Valid: email@domain(comment).com

    Invalid: (email@domain.com

    Invalid:  email@domain).com

    Invalid: emailspace@domain.com

    Invalid: email@spacedomain.com

    Please correct me if I am wrong…

  39. Kiran says:

    Very nice test cases for valid and invalid Email Address

  40. Romel says:

    _______@domain.com

    This is not valid email because RFC 3696

    tools.ietf.org/…/rfc3696

    requires:

    "Without quotes, local-parts may consist of any combination of

    alphabetic characters, digits, or any of the special characters

    ! # $ % & ' * + – / = ?  ^ _ ` . { | } ~

    period (".") may also appear, but may not be used to start or end the local part, nor may two or more consecutive periods appear."

    Correct, please, the table "Valid Email address".

  41. Nitish says:

    Can Comma (,) be used in email address?

  42. Nayana says:

    Is '*' valid in this emailid 'test*w@a.com' ?

Skip to main content