Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer's Guide

- Previous: Creating a JavaMail Session
- Next: Looking Up a JavaMail Session

# JavaMail Session Properties

You can set properties for a JavaMail `Session` object. Every property name must start with a `mail-` prefix. The Application Server changes the dash (`-`) character to a period (`.`) in the name of the property and saves the property to the `MailConfiguration` and JavaMail `Session` objects. If the name of the property doesn’t start with `mail-`, the property is ignored.

For example, if you want to define the property `mail.from` in a JavaMail `Session` object, first define the property as follows:

- Name - `mail-from`

- Value - `john.doe@sun.com`

After you get the JavaMail `Session` object, you can get the `mail.from` property to retrieve the value as follows:

    String password = session.getProperty("mail.from");

- Previous: Creating a JavaMail Session
- Next: Looking Up a JavaMail Session

- © 2010, Oracle Corporation and/or its affiliates