JavaMail API documentation

The JavaMailTM API includes the javax.mail package and subpackages.

JavaMail API Packages

Sun-specific Packages

Other Packages

com.sun.mail.dsn
com.sun.mail.imap
com.sun.mail.pop3
com.sun.mail.smtp
javax.mail
javax.mail.event
javax.mail.internet
javax.mail.search
javax.mail.util
The JavaMailTM API includes the javax.mail package and subpackages. The JavaMail API supports the following standard properties, which may be set in the Session object, or in the Properties object used to create the Session object. The properties are always set as strings; the Type column describes how the string is interpreted. For example, use
props.put("mail.debug", "true");
to set the mail.debug property, which is of type boolean.

NameTypeDescription
mail.debugboolean The initial debug mode. Default is false.
mail.fromString The return email address of the current user, used by the InternetAddress method getLocalAddress.
mail.mime.address.strictboolean The MimeMessage class uses the InternetAddress method parseHeader to parse headers in messages. This property controls the strict flag passed to the parseHeader method. The default is true.
mail.hostString The default host name of the mail server for both Stores and Transports. Used if the mail.protocol.host property isn't set.
mail.store.protocolString Specifies the default message access protocol. The Session method getStore() returns a Store object that implements this protocol. By default the first Store provider in the configuration files is returned.
mail.transport.protocolString Specifies the default message access protocol. The Session method getTransport() returns a Transport object that implements this protocol. By default the first Transport provider in the configuration files is returned.
mail.userString The default user name to use when connecting to the mail server. Used if the mail.protocol.user property isn't set.
mail.protocol.classString Specifies the fully qualified class name of the provider for the specified protocol. Used in cases where more than one provider for a given protocol exists; this property can be used to specify which provider to use by default. The provider must still be listed in a configuration file.
mail.protocol.hostString The host name of the mail server for the specified protocol. Overrides the mail.host property.
mail.protocol.portint The port number of the mail server for the specified protocol. If not specified the protocol's default port number is used.
mail.protocol.userString The user name to use when connecting to mail servers using the specified protocol. Overrides the mail.user property.

The JavaMail API also supports several System properties; see the javax.mail.internet package documentation for details.

The JavaMail reference implementation from Sun includes protocol providers in subpackages of com.sun.mail. Note that the APIs to these protocol providers are not part of the standard JavaMail API. Portable programs will not use these APIs.

Nonportable programs may use the APIs of the Sun protocol providers by (for example) casting a returned Folder object to a com.sun.mail.imap.IMAPFolder object. Similarly for Store and Message objects returned from the standard JavaMail APIs.

The Sun protocol providers also support properties that are specific to those providers. The package documentation for the IMAP, POP3, and SMTP packages provide details.