Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Darcy Jones   on Mar 30 In Java Category.

  
Question Answered By: Adali Fischer   on Mar 30

1. The construct if ( sendermail == " ") etc won't do what you think.

I would replace it with something like if ( isBlank( sendermail ) )

where isBlank is defined:

private boolean isBlank(String str)
{
if ( str == null ) return  false;
if ( str.trim().equals( "" ) ) return false
return true;
}

2. the check  .. no dots before the @ is not a valid  one
(I used to have an address  of David.Burnett@...)

3. For invalid email  addresses, throwing an exception in constructor seems to be
an option
if( !isAddressValid ( recipientmail ) )
throw new InvalidEmailAddressException( recipientmail );

Share: 

 
 
Didn't find what you were looking for? Find more on validation of the email Or get search suggestion and latest updates.


Tagged: