com.lavantech.net.mail
Class EmailAddress

java.lang.Object
  extended bycom.lavantech.net.mail.EmailAddress

public class EmailAddress
extends java.lang.Object

This class represents an Email Address.


Field Summary
 java.lang.String displayName
           
 java.lang.String domain
           
 java.lang.String emailId
           
 
Constructor Summary
EmailAddress(java.lang.String emailId, java.lang.String displayName)
          Constructs an EmailAddress with the given email id and display name.
EmailAddress(java.lang.String emailId, java.lang.String displayName, java.lang.String charset)
          Constructs an EmailAddress with the given email id and display name in an given Character Set.
 
Method Summary
 byte[] getEncodedBytes()
          Returns the Email Address in an encoded form that can be used in SMTP.
 java.lang.String toString()
          Returns a String representation of the Email Id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

emailId

public java.lang.String emailId

displayName

public java.lang.String displayName

domain

public java.lang.String domain
Constructor Detail

EmailAddress

public EmailAddress(java.lang.String emailId,
                    java.lang.String displayName)
             throws InvalidAddressException
Constructs an EmailAddress with the given email id and display name.

Parameters:
emailId - Email Id.
displayName - Complete name for the Email Id.
Throws:
InvalidAddressException - If the email id doesn't have a '@' in it or '.' after the '@' sign.

EmailAddress

public EmailAddress(java.lang.String emailId,
                    java.lang.String displayName,
                    java.lang.String charset)
             throws InvalidAddressException,
                    java.io.UnsupportedEncodingException
Constructs an EmailAddress with the given email id and display name in an given Character Set. This constructor is used to construct email id or display name in Non-ASCII character set.

Parameters:
emailId - Email Id.
displayName - Complete name for the Email Id.
charset - Canonical name for the character set.
Throws:
InvalidAddressException - If the email id doesn't have a '@' in it or '.' after the '@' sign.
java.io.UnsupportedEncodingException - If the given character set is not supported.
Method Detail

toString

public java.lang.String toString()
Returns a String representation of the Email Id. The returned string is in the form "Display Name"<someone@somewhere.com>


getEncodedBytes

public byte[] getEncodedBytes()
Returns the Email Address in an encoded form that can be used in SMTP. This is same as toString() if the character set is US-ASCII, else the email id and display name is encoded in Base64.

Returns:
byte array of the encoded email id and display name.