After a fit of similar frustration I wrote a short article on how to validate e-mail addresses programmatically. It's half serious and half entertainment, but it may be worth looking at.
Someone in one of the comments below the article mentioned that O'Reilly's 'Mastering Regular Expressions' has a RegEx that can be used that is 'pretty good'. According to the comment: "The most comprehensive version of this expression that I have seen is printed in Mastering Regular Expressions from O'Reilly. It is on page 316 and weighs in at 6,598 bytes long." See "How to validate an e-mail address" - http://www.oreillynet.com/pub/wlg/2379 |---------+-----------------------------> | | | | | "Noel J. Bergman" | | | <[EMAIL PROTECTED]> | | | 05/30/2003 07:30 PM | | | Please respond to "James | | | Users List" | | | | |---------+-----------------------------> >-----------------------------------------------------------------------------------------------------------------------------| | | | To: "James Users List" <[EMAIL PROTECTED]> | | cc: (bcc: Kevin Bedell/Systems/USHO/SunLife) | | Subject: RE: Is this a valid From: address? | >-----------------------------------------------------------------------------------------------------------------------------| > > javax.mail.internet.ParseException: Out of data at position 26 > no @ presumably.. can james handle a quoted local part without an > @ is the question. > I agree James should be handling this as a quoted local part with > no host or domain part. i.e. "nlt: Mail Administrator"@localhost Please point out where in either RFCs 821, 822, 2821, 2822 it indicates that such an address is legal. I looked earlier, and I do not see anything that permits a localpart with no domain, except for <postmaster>. A bug in the code, which certainly exists, is that it should check the position before trying to access the @, so that it can report the error that it wants to report. --- Noel --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------------- This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender and erase this e-mail message immediately. --------------------------------------------------------------------------- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]