Javamail-based bug tracking and defect tracking
Feb 24, 2004 | Home > Bugzero > FAQs > KB

JavaMail API documentation (from sun.com)

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.
Javamail bug tracking system

Name Type Description
mail.debug boolean The initial debug mode. Default is false.
mail.from String The return email address of the current user, used by the InternetAddress method getLocalAddress.
mail.mime.address.strict boolean 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.host String 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.protocol String 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.protocol String 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.user String The default user name to use when connecting to the mail server. Used if the mail.protocol.user property isn't set.
mail..class String 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..host String The host name of the mail server for the specified protocol. Overrides the mail.host property.
mail..port int The port number of the mail server for the specified protocol. If not specified the protocol's default port number is used.
mail..user String The user name to use when connecting to mail servers using the specified protocol. Overrides the mail.user property.

The JavaMail API supports the following System properties, which may be set using the System method setProperty.

Name Type Description
mail.mime.charset String The default charset to be used by JavaMail. If not set (the normal case), the standard J2SE file.encoding System property is used. This allows applications to specify a default character set for sending messages that's different than the character set used for files stored on the system. This is common on Japanese systems.
mail.mime.decodetext.strict boolean RFC 2047 requires that encoded text start at the beginning of a whitespace separated word. Some mailers, especially Japanese mailers, improperly encode text and include encoded text in the middle of words. This property controls whether JavaMail will attempt to decode such incorrectly encoded text. The default is true, meaning that JavaMail wil not attempt to decode such improperly decoded text.
mail.mime.encodeeol.strict boolean When choosing an encoding for the data of a message, JavaMail assumes that any of CR, LF, or CRLF are valid line terminators in message parts that contain only printable ASCII characters, even if the part is not a MIME text type. It's common, especially on UNIX systems, for data of MIME type application/octet-stream (for example) to really be textual data that should be transmitted with the encoding rules for MIME text. In rare cases, such pure ASCII text may in fact be binary data in which the CR and LF characters must be preserved exactly. If this property is set to true, JavaMail will consider a lone CR or LF in a body part that's not a MIME text type to indicate that the body part needs to be encoded. The default is false.

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 com.sun.mail.imap, com.sun.mail.pop3, com.sun.mail.smtp packages provide details.

* Reference brought to you by Bugzero, it's more than just bug tracking software!