1

I am validating a email address adheres to the RFC822 format by a creating email address object using javamail 1.4.4 'InternetAddress' Class.

InternetAddress internetAdd = new InternetAddress("test@test.com");

If it throws an AddressException then it's invalid.

Is there any simpler break down of what type of email address are accepted other than reading the RFC822 documentation?
http://www.w3.org/Protocols/rfc822/#z25

For example, what special charchters can it contain, etc?

Thanks

Thomas Buckley
  • 5,836
  • 19
  • 62
  • 110
  • Verifying EMail addresses is really, really tough. [This Q/A might help.](http://stackoverflow.com/questions/624581/what-is-the-best-java-email-address-validation-method) – Andreas Dolk May 31 '11 at 13:05
  • Thanks Andreas. Yeah I think we will stick with the use of InternetAddress and use the following link as a reference for what is acceptable in the local part: http://www.remote.org/jochen/mail/info/chars.html. Basically, we will need to agree upon what is acceptable and not between development and QA. – Thomas Buckley May 31 '11 at 13:35

1 Answers1

0

I went with the javamail InternetAddress method in the end. There are common things that you would think it should reject, but are actually acceptable!

Thomas Buckley
  • 5,836
  • 19
  • 62
  • 110