To run the confirmer example, follow these steps, as described in the following sections:
Create a mail session in the Admin Console.
Build the example.
Deploy the example.
Retrieve the client JAR.
Run the client JAR.
Select the JavaMail Sessions node.
Type mail/myMailSession in the JNDI Name field.
Type the name of the host running your mail server in the Mail Host field.
Type the destination email address in the Default User field.
Type your email address in the Default Return Address field.
Note that mail/myMailSession is listed under the JavaMail Sessions node.
Follow these instructions to build, package, and deploy the confirmer example to your Application Server instance using the NetBeans IDE IDE.
In NetBeans IDE, select File->Open Project.
In the Open Project dialog, navigate to tut-install/javaeetutorial5/examples/ejb/.
Select the confirmer folder.
Select the Open as Main Project and Open Required Projects check boxes.
Click Open Project.
In the Projects tab, right-click the confirmer project and select Undeploy and Deploy.
This builds and packages the application into confirmer.ear, located in tut-install/javaeetutorial5/examples/ejb/confirmer/dist, and deploys this EAR file to your Application Server instance.
To build and package the confirmer example, do the following:
In a terminal window, go to tut-install/examples/ejb/confirmer.
Enter the following command:
This compiles the source code and creates an EAR file, confirmer.ear, in the dist directory.
To deploy confirmer.ear, type the following command in a terminal window:
By default, the client sends a message to firstname.lastname@example.org, a fictional email address. To change the email address in NetBeans IDE, do the following:
Right-click the confirmer project in the Projects pane and select Properties.
Click the Run category.
In the Client Information area, under Arguments, enter the email address to which you want the message sent.
To run the client in NetBeans IDE, right-click the confirmer project in the Projects pane and select Run. You should see the following line when the client has successfully sent the test message:
... Message sent to email@example.com. ...
By default, the client sends a message to firstname.lastname@example.org, a fictional email address. To change the email address, set the app-client.args property in tut-install/examples/ejb/confirmer/nbproject/project.properties to the email address to which you’d like the test message sent. For example:
To retrieve the client JAR and run the client, enter the following command in a terminal:
You should see the following line when the client has successfully sent the test message:
[exec] Message sent to email@example.com.
If you changed the target email address, the test message should arrive in the user’s inbox in a few moments.