geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Boynes <>
Subject Re: JavaMail
Date Mon, 22 Aug 2005 14:55:43 GMT
Neal Sanche wrote:
> Well, I've looked through the source and found the 
> org.apache.geronimo.mail module. It seems to contain a few GBeans and 
> some tests. The tests are mostly empty. How would I create an SMTP 
> transport session from my code?

The easiest way is to define a resource reference in the standard 
deployment descriptor:


You can then look up the resource with code like:

     javax.mail.Session sess = (Session)
        new InitialContext().lookup("java:comp/env/mail/MailSession");

We don't provide a default session but you can define one using a GBean 
in your deployment plan:

     <gbean name="mail/MailSession"
         <attribute name="host"></attribute>

Other attributes can be set as appropriate; I think we support all the 
"standard" mail.smtp ones and non-standard ones can be set through the 
"properties" attribute.


View raw message