asadmin create-javamail-resource --mailhost mail.example.com --mailuser example --fromaddress firstname.lastname@example.org --storeprotocol=imap --storeprotocolclass=com.sun.mail.imap.IMAPStore --transprotocol=smtp --transprotocolclass=com.sun.mail.smtp.SMTPTransport --password mypassword --auth true --property mail-smtp-starttls-enable=true --target=exampleNodeName mail/EmailNotifications
A JavaMail session resource represents a mail session within the JavaMail API. JavaMail sessions configured here can be referred to by their JNDI name.
Configurating a JavaMail session from the Admin Console
JavaMail sessions are added from the
Resources tab on the left pane of
the Admin Console. Select
New on the
Sessions table to create a new
Emails will be sent with a return address of
SMTP to send mail and
IMAP to retrieve mail. With the current
implementation of the JavaMail API there is no alternative transport
protocol provided by default, though as an alternative to the default
store protocol of
pop3 is available.
All protocols require that their associated protocol package be included; more details on the JavaMail API documentation.
Typically, when setting up
SMTP access, three additional properties
must be specified in the Additional Properties table: enabling
enabling authentication, and the password. These allow for extra
security when sending emails and will not always be required - check
with your email provider for their specific configuration.
The example below shows the configuration of a mail host:
Configurating a JavaMail session using an asadmin command
JavaMail sessions can be created directly using an asadmin command as well.
Additional Properties (as entered on the table on the Admin Console) are
added with the
--property command-line argument as a series of colon
separated key/value pairs.
The sample command below demonstrates this, using the same configuration as pictured on the previous section: