JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Administration Guide
search filter icon
search icon

Document Information

Preface

1.  Overview of GlassFish Server Administration

Default Settings and Locations

Configuration Tasks

Administration Tools

Instructions for Administering GlassFish Server

Part I Runtime Administration

2.  General Administration

3.  Administering Domains

4.  Administering the Virtual Machine for the Java Platform

5.  Administering Thread Pools

6.  Administering Web Applications

7.  Administering the Logging Service

8.  Administering the Monitoring Service

9.  Writing and Running JavaScript Clients to Monitor GlassFish Server

10.  Administering Life Cycle Modules

11.  Extending and Updating GlassFish Server

Part II Resources and Services Administration

12.  Administering Database Connectivity

13.  Administering EIS Connectivity

14.  Administering Internet Connectivity

15.  Administering the Object Request Broker (ORB)

16.  Administering the JavaMail Service

About JavaMail

Administering JavaMail Resources

To Create a JavaMail Resource

To List JavaMail Resources

To Update a JavaMail Resource

To Delete a JavaMail Resource

17.  Administering the Java Message Service (JMS)

18.  Administering the Java Naming and Directory Interface (JNDI) Service

19.  Administering Transactions

Part III Appendixes

A.  Subcommands for the asadmin Utility

Index

Administering JavaMail Resources

When you create a mail session, the server-side components and applications are enabled to access JavaMail services with JNDI, using the session properties you assign for them. When creating a mail session, you can designate the mail hosts, the transport and store protocols, and the default mail user so that components that use JavaMail do not have to set these properties. Applications that are heavy email users benefit because GlassFish Server creates a single session object and makes the session available to any component that needs it.

JavaMail settings such as the following can be specified:

The following topics are addressed here:

To Create a JavaMail Resource

Use the create-javamail-resource subcommand in remote mode to create a JavaMail session resource. The JNDI name for a JavaMail session resource customarily includes the mail/ naming subcontext, For example: mail/MyMailSession.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. Create a JavaMail resource by using the create-javamail-resource(1) subcommand.

    Information about the properties for the subcommand is included in this help page.

  3. To apply your changes, restart GlassFish Server.

    See To Restart a Domain.

Example 16-1 Creating a JavaMail Resource

This example creates a JavaMail resource named mail/MyMailSession. The escape character (\) is used in the --fromaddress option to distinguish the dot (.) and at sign (@).

asadmin> create-javamail-resource --mailhost localhost --mailuser sample --fromaddress sample\@sun\.com mail/MyMailSession 
Command create-javamail-resource executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help create-javamail-resource at the command line.

To List JavaMail Resources

Use the list-javamail-resources subcommand in remote mode to list the existing JavaMail session resources.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the JavaMail resources by using the list-javamail-resources(1) subcommand.

Example 16-2 Listing JavaMail Resources

This example lists the JavaMail resources on localhost.

asadmin> list-javamail-resources 
mail/MyMailSession
Command list-javamail-resources executed successfuly.

See Also

You can also view the full syntax and options of the subcommands by typing asadmin help list-javamail-resources at the command line.

To Update a JavaMail Resource

  1. List the JavaMail resources by using the list-javamail-resources(1) subcommand.
  2. Modify the values for the specified JavaMail source by using the set(1) subcommand.

    The resource is identified by its dotted name.

Example 16-3 Updating a JavaMail Resource

This example changes joeserver to joe.

asadmin> set server.resources.mail-resource.mail/
MyMailSession.user=joeserver.resources.mail-resource.mail/
MyMailSession.user=joe
Command set executed successfully.

To Delete a JavaMail Resource

Use the delete-javamail-resource subcommands in remote mode to delete a JavaMail session resource.

Before You Begin

References to the specified resource must be removed before running the delete-javamail-resource subcommands.

  1. Ensure that the server is running.

    Remote subcommands require a running server.

  2. List the JavaMail resources by using the list-javamail-resources(1) subcommands.
  3. Delete a JavaMail resource by using the delete-javamail-resource(1) subcommands.
  4. To apply your changes, restart GlassFish Server.

    See To Restart a Domain.

Example 16-4 Deleting a JavaMail Resource

This example deletes the JavaMail session resource named mail/MyMailSession.

asadmin> delete-javamail-resource mail/MyMailSession 
Command delete-javamail-resource executed successfully.

See Also

You can also view the full syntax and options of the subcommand by typing asadmin help delete-javamail-resource at the command line.