Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Administration Reference

- Previous: Attributes
- Next: manager-properties

### Properties

You can set properties for the `mail-resource` element and then get these properties in a JavaMail `Session` object later. 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, then 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, to define the property `mail.password` in a JavaMail Session object, first edit `domain.xml` as follows:

    ...
     <mail-resource jndi-name="mail/Session" ...>
         <property name="mail-password" value="adminadmin"/>
     </mail-resource>
     ...

After getting the JavaMail `Session` object, get the `mail.password` property to retrieve the value `adminadmin`, as follows:

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

- Previous: Attributes
- Next: manager-properties

- © 2010, Oracle Corporation and/or its affiliates