Name

Session

Synopsis

The Session object provides access to the current JavaMail session and, therefore, to most JavaMail functionality. Instances of Session are retrieved via the static getSession() method, which allows creation of unshared mail sessions, and getDefaultInstance(), which returns a default session for the current JVM.

The various get methods of Session can be used to retrieve message stores and transports. The set methods can be used to specify default service providers, or to set a PasswordAuthentication object for a particular mail URL.

public final class Session {
// No Constructor
                  // Public Class Methods
   public static javax.mail.Session getDefaultInstance(          // 1.2
        java.util.Properties props);  
   public static javax.mail.Session getDefaultInstance(
        java.util.Properties props, 
        javax.mail.Authenticator authenticator);  
   public static javax.mail.Session getInstance(                 // 1.2
        java.util.Properties props);  
   public static javax.mail.Session getInstance(
        java.util.Properties props, 
        javax.mail.Authenticator authenticator);  
// Property Accessor Methods (by property name)
   public boolean getDebug();  
   public void setDebug( boolean debug);  
   public java.util.Properties getProperties();  
   public void setProvider(
        javax.mail.Provider provider) throws javax.mail.NoSuchProviderException;  
   public javax.mail.Provider[] getProviders();  
   public Store getStore(
        ) throws javax.mail.NoSuchProviderException;  
   public Store getStore(
        URLName url) throws javax.mail.NoSuchProviderException;  
   public Store getStore ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.