40/461

## create-javamail-resource

creates a JavaMail session resource

Synopsis

    create-javamail-resource [--help] [--target target] --mailhost hostname
    --mailuser username --fromaddress address [--storeprotocol storeprotocol]
    [--storeprotocolclass storeprotocolclass] [--transprotocol transprotocol]
    [--transprotocolclass transprotocolclass] [--debug={false|true}] [--enabled={true|false}]
    [--description resource-description] [--property (name=value)[:name=value]*] jndi-name

Description

The `create-javamail-resource` subcommand creates a JavaMail session resource.

This subcommand is supported in remote mode only.

Options

`--help`
`-?`

  Displays the help text for the subcommand.

`--target`

  This option specifies the target for which you are creating the JavaMail session resource. Valid values are:

  `server`

    Creates the resource for the default server instance. This is the default value.

  `domain`

    Creates the resource for the domain.

  cluster_name

    Creates the resource for every server instance in the cluster.

  instance_name

    Creates the resource for a particular server instance.

`--mailhost`

  The DNS 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.

`--mailuser`

  The name of the mail account user provided 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.

`--fromaddress`

  The email address of the default user, in the form username`@`host`.`domain.

`--storeprotocol`

  The mail server store protocol. The default is `imap`. Change this value only if you have reconfigured the GlassFish Server's mail provider to use a non-default store protocol.

`--storeprotocolclass`

  The mail server store protocol class name. The default is `com.sun.mail.imap.IMAPStore`. Change this value only if you have reconfigured the GlassFish Server's mail provider to use a nondefault store protocol.

`--transprotocol`

  The mail server transport protocol. The default is `smtp`. Change this value only if you have reconfigured the GlassFish Server's mail provider to use a nondefault transport protocol.

`--transprotocolclass`

  The mail server transport protocol class name. The default is `com.sun.mail.smtp.SMTPTransport`. Change this value only if you have reconfigured the GlassFish Server's mail provider to use a nondefault transport protocol.

`--debug`

  If set to true, the server starts up in debug mode for this resource. If the JavaMail log level is set to `FINE` or `FINER`, the debugging output will be generated and will be included in the server log file. The default value is false.

`--enabled`

  If set to true, the resource is enabled at runtime. The default value is true.

`--description`

  Text providing some details of the JavaMail resource.

`--property`

  Optional attribute name/value pairs for configuring the JavaMail resource. The GlassFish Server-specific `mail-` prefix is converted to the standard mail prefix. The JavaMail API documentation lists the properties you might want to set.

Operands

jndi-name

  The JNDI name of the JavaMail resource to be created. It is a recommended practice to use the naming subcontext prefix `mail/` for JavaMail resources.

Examples

Example 1 Creating a JavaMail Resource

  This example creates a JavaMail resource named `mail/MyMailSession`. The JNDI name for a JavaMail session resource customarily includes the `mail/` naming subcontext.

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

Exit Status

0

  subcommand executed successfully

1

  error in executing the subcommand

See Also

delete-javamail-resource(1), list-javamail-resources(1)

asadmin(1M)