• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there a really compliant RFC-822 email validator library?  RSS feed

 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been using the Apache commons-validator to do syntax validation of email addresses. In the javadocs, it say that its not fully compliant. It doesn't go into details, but I bet it may not properly handle email addresses for obsolete systems such as Multics, Tops-20, etc. and perhaps doesn't handle bang-path addressing.

Does anyone know of any libraries (preferably open source) that fully implement RFC822 syntactic checks?
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
javax.mail.internet.InternetAddress says it
represents an Internet email address using the syntax of RFC822.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:javax.mail.internet.InternetAddress says it
represents an Internet email address using the syntax of RFC822.

Neat. Never knew about that class. Thanks Rob.

@Pat: Just to let you know that the docs for the parse() method for that class do say:
"...If strict is true, many (but not all) of the RFC822 syntax rules are enforced. In particular, even if strict is true, addresses composed of simple names (with no "@domain" part) are allowed. Such "illegal" addresses are not uncommon in real messages."

I don't know whether that has any bearing on the equivalent constructor logic, but they do have similar signatures.

Winston
 
Pat Farrell
Rancher
Posts: 4686
7
Linux Mac OS X VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Such "illegal" addresses are not uncommon in real messages.

Thanks.
Sadly, my problem is that we are using email addresses for unique identifiers (no OAuth here).

I expect I'll just do as everyone else does, and get something "close enough" since the more weird features of RFC822 are for computer systems that have been obsolete for at least a decade.

As far as I can find, the only real way to validate an email address is to send something to it. If the message bounces, you can usually tell that its a bad address. But if it does not bounce, all you know is that the bounce message didn't get to you.
 
Paul Clapham
Sheriff
Posts: 22843
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pat Farrell wrote:As far as I can find, the only real way to validate an email address is to send something to it. If the message bounces, you can usually tell that its a bad address. But if it does not bounce, all you know is that the bounce message didn't get to you.


It's worse than that. A lot of times when you look at the bounce message, it says something like "This message was not delivered because the receiver's mailbox was full". So, the e-mail address was perfectly valid, just useless.
 
Rob Spoor
Sheriff
Posts: 21135
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or mail servers are setup to use a "black hole" for any email that is sent to a non-existing user on the server. You'll think the message has been successfully delivered but in fact it has disappeared into nothingness.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!