Java Reference
In-Depth Information
5. Enter the configuration settings for your SMTPS server in
glassfish-re-
sources.xml
.
The SMTPS server host name is set in the
host
attribute; the email address from
which you want the message sent is set in the
from
attribute; and the SMTPS
user name is set in the
user
attribute. Set the
mail-smtps-password
prop-
erty value to the password for the SMTPS server user. The following code snippet
shows an example resource configuration. Lines in bold need to be modified.
<resources>
<mail-resource debug="false"
enabled="true"
from="user@example.com"
host="smtp.example.com"
jndi-name="mail/myExampleSession"
object-type="user" store-protocol="imap"
store-protocol-class="com.sun.mail.imap.IMAPStore"
transport-protocol="smtps"
transport-protocol-
class="com.sun.mail.smtp.SMTPSSLTransport"
user="user@example.com"
>
<description/>
<property name="mail-smtps-auth" value="true"/>
<property name="mail-smtps-password"
value="mypassword"
/>
</mail-resource>
</resources>
6. Right-click
async
in the project pane and select Run.
This will compile, assemble, and deploy the application, and start a web browser
at the following URL:
http://localhost:8080/async
.
7. In the web browser window, enter the email to which you want the test mes-
sage sent and click Send email.
If your configuration settings are correct, a test email will be sent, and the status
message will read
Sent
in the web client. The test message should appear mo-
mentarily in the inbox of the recipient.
If an error occurs, the status will read
Encountered an error
. Check the
server.log
file for your domain to find the cause of the error.
To Run the
async
Example Using Ant
1. In a terminal window, navigate to
tut-install
/examples/ejb/async/
.