InternetAddress validation
1 posts in topic
Flat View  Flat View

Posted By:   Roman_Schloemmer
Posted On:   Monday, July 29, 2002 03:19 AM

In the following code I try to parse a user entered eMail address. Somehow no AddressException is thrown when I enter an address like According to RFC822 I think the address must contain an "@". What can I do to force the user to enter an address like

addr = "";
InternetAddress iAddress = new InternetAddress(addr);
}catch(AddressException ex){
System.out.pritnln("Exception: " + ex);

Re: InternetAddress validation

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, July 29, 2002 06:37 AM

Maybe it is taking "foo" as the localpart, assuming your local domain will be added by the local mail system e.g. it will be turned into "" (equivalently, taking "" and assuming it will be turned into "").

The local MTA (e.g. Sendmail or whatever) can be configured to accept bare localparts (e.g. "foo") in rfc822 address headers (e.g. "From:", "Reply-To:", "To:", "Cc:", "Bcc:"), and assume it will be constructing the rfc821 envelope addresses from them (e.g. the "MAIL FROM" and "RCPT TO" and DSN's) and that consequently it should append the local domain to them (e.g. ""). Or (better) it can be configured to require domains on addresses, in which case it (the local MTA) will reject the message submission.

About | Sitemap | Contact