HomeDocumentation > Sample applications > Using Geronimo's default JavaMail session

Note: This was tested on trunk and should be the same steps for Geronimo v1.2 and v2.0 with minor changes specifically references to JavaMail module ID.

1. Download Apache JAMES from: http://apache2.openmirrors.org/james/server/binaries/james-2.3.0.zip

2. Unzip file and run JAMES by executing: \james-2.3.0\bin\run.bat. You should see something like this:

3. Make sure JavaMail module is started:

  • For trunk and v2.0-M1: org.apache.geronimo.configs/javamail/2.0-SNAPSHOT/car (by default this is started)
  • For v1.2-beta: org.apache.geronimo.configs/javamail/1.2-beta/car (by default this is not started)
  • To start the module you can:

a. Use the Web Console: Applications > System Modules > Click 'Start' link beside the JavaMail module ID

b. Use command line deployer:

c. Stop the server. Modify <geronimo_home>\var\config\config.xml and set JavaMail module load attribute to 'true':

Note: You can configure the SMTP transport's host and port by overriding the values of the SMTPTransport GBean attrbitues. For our test we will use the default. This will allow us to connect to JAMES running in localhost and using port 25 (the default SMTP port).

3. Create a simple webapp (sendmail.war - attached in this issue) containing the following files:

web.xml:

geronimo-web.xml:

index.jsp:

4. Deploy sendmail.war:

a. Using Web Console: Applications > Deploy New > Set 'Archive:' to sendmail.war and click 'Install'

b. Using command line deployer:

5. Test send mail webapp by going to: http://localhost:8080/sendmail

Fill up the form (From, To, Subject, Message fields) and click 'Send' button. You should get a similar message if the mail was sent successfully: