java.lang.Object | +--javax.mail.Session
boolean | getDebug() Get the debug setting for this Session. |
PrintStream | Returns the stream to be used for debugging output. |
static Session | getDefaultInstance(Properties props, Authenticator authenticator) Get the default Session object. |
static Session | getDefaultInstance(Properties props) Get the default Session object. |
Get a closed Folder object for the given URLName. | |
static Session | getInstance(Properties props, Authenticator authenticator) Get a new Session object. |
static Session | getInstance(Properties props) Get a new Session object. |
getPasswordAuthentication(URLName url) Return any saved PasswordAuthentication for this (store or transport) URLName. | |
Properties | Returns the Properties object associated with this Session. |
String | getProperty(String name) Returns the value of the specified property. |
getProvider(String protocol) Returns the default Provider for the protocol specified. | |
Provider[] | This method returns an array of all the implementations installed via the javamail.[default.]providers files that can be loaded using the ClassLoader available to this application. |
getStore() Get a Store object that implements this user's desired Store protocol. | |
getStore(String protocol) Get a Store object that implements the specified protocol. | |
Get a Store object for the given URLName. | |
Get an instance of the store specified by Provider. | |
Get a Transport object that implements this user's desired Transport protocol. | |
getTransport(String protocol) Get a Transport object that implements the specified protocol. | |
getTransport(URLName url) Get a Transport object for the given URLName. | |
getTransport(Provider provider) Get an instance of the transport specified in the Provider. | |
getTransport(Address address) Get a Transport object that can transport a Message to the specified address type. | |
requestPasswordAuthentication(InetAddress address, int port, String protocol, String prompt, String defaultUserName) Call back to the application to get the needed user name and password. | |
void | setDebug(boolean debug) Set the debug setting for this Session. |
void | setDebugOut(PrintStream out) Set the stream to be used for debugging output for this session. |
void | setPasswordAuthentication(URLName url, PasswordAuthentication pw) Save a PasswordAuthentication for this (store or transport) URLName. |
void | setProvider(Provider provider) Set the passed Provider to be the default implementation for the protocol in Provider.protocol overriding any previous values. |
public boolean getDebug()
public PrintStream getDebugOut()
System.out
is returned.
public static Session getDefaultInstance(Properties props)
public static Session getDefaultInstance(Properties props, Authenticator authenticator)
public Folder getFolder(URLName url)
NoSuchProviderException
- If a provider for the given URLName
is not found.public static Session getInstance(Properties props)
public static Session getInstance(Properties props, Authenticator authenticator)
public PasswordAuthentication getPasswordAuthentication(URLName url)
public Properties getProperties()
public String getProperty(String name)
public Provider getProvider(String protocol)
mail.<protocol>.class
property first
and if it exists, returns the Provider associated with
this implementation. If it doesn't exist, returns the Provider that
appeared first in the configuration files.
If an implementation for the protocol isn't found,
throws NoSuchProviderException
public Provider[] getProviders()
public Store getStore()
mail.store.protocol
property specifies the desired
protocol. If an appropriate Store object is not obtained,
NoSuchProviderException is thrown
public Store getStore(String protocol)
public Store getStore(Provider provider)
public Store getStore(URLName url)
public Transport getTransport()
mail.transport.protocol
property specifies the desired
protocol. If an appropriate Transport object cannot be obtained,
MessagingException is thrown.
NoSuchProviderException
- If the provider is not found.public Transport getTransport(String protocol)
NoSuchProviderException
- If the provider is not found.public Transport getTransport(Address address)
NoSuchProviderException
- If the provider is not found.public Transport getTransport(Provider provider)
NoSuchProviderException
- If the provider is not found.public Transport getTransport(URLName url)
NoSuchProviderException
- If the provider is not found.public PasswordAuthentication requestPasswordAuthentication(InetAddress address, int port, String protocol, String prompt, String defaultUserName)
Connecting to mail service on host , port . User Name: Password
public void setDebug(boolean debug)
mail.debug
in the Properties object passed in to the
constructor to true. The value of the mail.debug
property
is used to initialize the per-Session debugging flag. Subsequent calls
to the setDebug
method manipulate the per-Session debugging
flag and have no affect on the mail.debug
property.
public void setDebugOut(PrintStream out)
out
is null, System.out
will be used. Note
that debugging output that occurs before any session is created, as a
result of setting the mail.debug
property, will always be
sent to System.out
.
public void setPasswordAuthentication(URLName url, PasswordAuthentication pw)
pw
is null the entry corresponding to the URLName
is removed.
This is normally used only by the store or transport implementations to
allow authentication information to be shared among multiple uses of a
session.
public void setProvider(Provider provider)