Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

This article describes how to install a typical mail system, and access it from a simple web application to provide a server based email client. It does not go into details about how to create a configure the mail system itself.

...

3. Run JAMES by executing: \james-2.3.1\bin\run.bat. You should see something like this:

...

...

For MAC OSX and possibly other unix based systems James must be run under the super user to have authorization to leverage the designated ports.

4. Make sure Geronimo JavaMail module is started:

  • Check Geronimo console System Modules for a component name beginning with org.apache.geronimo.configs/javamail. This module is present and started by default in the javaee5 instances of the server (both jetty and tomcat).
  • If, for some reason, the module is not started or not present then you can start the module via:
    • Use the Web Console: Applications > System Modules > Click 'Start' link beside the JavaMail module ID (you may have to enable expert mode)
    • Use command line deployer: Code BlockxmlborderStylesolidxml cd <geronimo_home>\bin java -jar deployer.jar --user system --password manager start org.apache.geronimo.configs/javamail/2.X/car
    • Stop the server. Modify <geronimo_home>\var\config\config.xml and set JavaMail module load attribute to 'true': Code BlockxmlborderStylesolidxml ... <module load="true" name="org.apache.geronimo.configs/javamail/2.0-SNAPSHOT/car"> <gbean name="SMTPTransport"> <attribute name="host">localhost</attribute> <attribute name="port">25</attribute> </gbean> </module> ...

...

...

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).

...

Test with Basic Web Application

Create a simple webapp containing the following files:

...

web.xml:

...

geronimo-web.xml: This deployable is using Geronimo 2.0's JavaMail component, so it needs to specify where to look. It does this under the <dependencies> tag. As Geronimo changes, these paths need to be changed accordingly to ensure that it refers to the same things. Under the <resource-ref> element, it is referring to a JavaMail session. This is what allows the developer to reference resources that resides on the server. The <ref-name> element is used in the web.xml so the two must be consistent. The <resource-link> element specifies the default Geronimo mail session.

...

...

index.jsp:

...

...

Building and Deploying the Web Application

...

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:

...

...