Skip navigation.

Administration Console Online Help

PreviousNextvertical dots separating previous/next from contents/index/pdfContents

Configure access to JavaMail

Before you begin

Configure a mail server or establish user credentials for an existing mail server. Mail sessions and the JavaMail API do not provide mail server functions; they merely enable applications to send and receive data from an existing mail server.

WebLogic Server includes the JavaMail API reference implementation from Sun Microsystems. JavaMail APIs provide applications and other J2EE modules with access to Internet Message Access Protocol (IMAP)- and Simple Mail Transfer Protocol (SMTP)-capable mail servers on your network or the Internet.

In the reference implementation of JavaMail, applications must instantiate javax.mail.Session objects, which designate mail hosts, transport and store protocols, and a default mail user for connecting to a mail server. In WebLogic Server, you use the Administration Console to create a mail session, which configures a javax.mail.Session object and registers it in the WebLogic Server JNDI tree. Applications access the mail session through JNDI instead of instantiating their own javax.mail.Session object.

To create a mail session:

  1. If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit (see Use the Change Center).
  2. In the Administration Console, expand Services and select Mail Sessions.

    The Mail Sessions table displays in the right pane showing all the mail sessions defined in your domain.

  3. On the Mail Sessions page, do one of the following:
    • Click the New button.
    • To copy the properties in an existing mail session, select the session and click Clone.

    Note: Once you create a mail session, you cannot rename it. Instead, you must clone it and give the clone the new name.

  4. On the Create a new mail session page, enter a name for your mail session and click OK.
  5. On the Mail Sessions page, click the new mail session name.
  6. On the Mail Sessions: Configuration page, in JNDI Name, enter a unique JNDI name.

    Applications use the value that you enter to look up the mail session. For example, if you enter myMailSession, applications do the following:

    InitialContext ic = new InitialContext();
    Session session = (Session) ic.lookup("myMailSession");
  7. In Properties, specify information for connecting to an existing mail server.

    The following table describes all valid properties and default values (all of which are derived from the JavaMail API Design Specification).

    Specify a property only if you want to override the default value. If you do not specify any properties, this mail session will use the JavaMail default property values.

    Express each property as a name=value pair. Separate multiple properties with a semicolon (;).

    Property Description Default Protocol for retrieving email. Example: imap
    mail.transport.protocol Protocol for sending email. Example: mail.transport.protocol=smtp smtp The name of the mail host machine. Example: Local machine
    mail.user Name of the default user for retrieving email. Example: mail.user=postmaster Value of the Java system property. Mail host for a specific protocol. For example, you can set and to different machine names. Examples: Value of the property.
    mail.protocol.user Protocol-specific default user name for logging into a mailer server. Examples: mail.smtp.user=weblogic mail.imap.user=appuser Value of the mail.user property.
    mail.from The default return address. Examples: username@host
    mail.debug Set to True to enable JavaMail debug output. False

    Note: Applications can override any properties set in the mail session by creating a Properties object containing the properties you want to override. See Programming JavaMail with WebLogic Server.

  8. Click Save to save your changes.

After you finish

Target mail sessions


Skip navigation bar   Back to Top