View RSS Feed

Java Mail

Java Mail API Session

Rate this Entry
by , 04-25-2012 at 10:49 PM (886 Views)
Top leveled entry class that presents mailing session is known as session. java.util.Properties object is used for seeking information regarding username/password and mail server. Private constructor is present in this class and session objects can be obtained via getDefaultInstance() & getInstance() method. The default session object are provided by the getDefaultInstance() method where authenticator objects and properties are taken as arguments.

Java Code:
Properties props = new Properties();
// code to fill props with any information
Session session = Session.getDefaultInstance(props, null);
Or unique session is created by getInstance() method…
Java Code:
Properties props = new Properties();
// code to fill props with any information
Session session = Session.getInstance(props, null);

Submit "Java Mail API Session" to Facebook Submit "Java Mail API Session" to Digg Submit "Java Mail API Session" to del.icio.us Submit "Java Mail API Session" to StumbleUpon Submit "Java Mail API Session" to Google

Categories
Mail API

Comments