en.help.task-javamailsessioncreate.html Maven / Gradle / Ivy
To Create a JavaMail Session
-
In the navigation tree, expand the Resources node.
-
Under the Resources node, select JavaMail Sessions.
The JavaMail Sessions page opens.
-
In the Sessions table, click New.
The New JavaMail Session page opens.
-
In the JNDI Name field, type a unique name for the mail session resource.
Use the naming sub-context prefix mail/
for JavaMail resources. For example: mail/MySession
. The name must contain only alphanumeric, underscore, dash, or dot characters.
-
In the Mail Host field, type the host name of the default mail server.
The connect methods of the Store and Transport objects use this value if a protocol-specific host property is not supplied. The name must be resolvable to an actual host name.
-
In the Default User field, type the user name to provide when connecting to a mail server.
The connect methods of the Store and Transport objects use this value if a protocol-specific username property is not supplied. The user name must contain only alphanumeric, underscore, dash, or dot characters.
-
In the Default Sender Address field, type the e-mail address of the default user.
The format is username@
host.domain.
-
In the Description field, type a description of this mail session.
-
Select the Status Enabled checkbox to enable the mail session.
The default value is Enabled.
-
In the Store Protocol field, define the storage protocol service to be used.
The storage protocol service connects to a mail server, retrieves messages, and saves messages in one or more folders. Allowed values are imap
, pop3
, imaps
, and pop3s
. The default value is imap
.
-
In the Store Protocol Class field, specify the service provider implementation class for storage.
Allowed values are:
-
com.sun.mail.imap.IMAPStore
-
com.sun.mail.pop3.POP3Store
-
com.sun.mail.imap.IMAPSSLStore
-
com.sun.mail.pop3.POP3SSLStore
The default value is com.sun.mail.imap.IMAPStore
.
-
In the Transport Protocol field, specify the transport communication method.
The transport protocol service sends messages. Allowed values are smtp
and smtps
. By default, the Transport Protocol is smtp
.
-
In the Transport Protocol Class field, specify the service provider implementation class for transport.
The default value is com.sun.mail.smtp.SMTPTransport
.
-
Select the Debug checkbox to enable extra debugging output, including a protocol trace, for this mail session.
If the JavaMail log level is set to FINE
or finer, the debugging output is generated and is included in the system log file. See To Configure Log Levels for information about setting the log level. This option is disabled by default.
-
In the Additional Properties table, specify additional properties required by applications, such as a protocol-specific host or username property.
For a list of the available properties, see the JavaMail API documentation (http://java.sun.com/products/javamail/javadocs/index.html
). Additional properties must begin with mail-
and must use hyphens, not periods, as separators. For example, mail-debug
is correct, but mail.debug
is not. The GlassFish Server back end converts the hyphens into the periods expected by the JavaMail API.
To add a property, click the Add Property button. In the blank row that appears, type the property name in the Name field, and type the property value in the Value field.
-
From the list of available targets, select the target or targets to which to configure the mail session and click Add.
Targets can be clusters or standalone server instances. If you do not select a target, the session is configured to the default server instance server
.
-
Click OK.
See Also
Copyright © 2005, 2017, Oracle and/or its affiliates. All rights reserved. Legal Notices