Apparently the older version 0.5 has made it to the central maven repository, but v0.6 has not - it should be synced by tonight or tomorrow morning. In the mean-time, feel free to use http://repo.israfil.net/maven2 until it syncs. It's best to use 0.6, since 0.5 had an error in the auto-loading metadata. That's the only difference between them though.

Christian.

On 6-May-09, at 15:00 , Christian Edward Gruber wrote:

Hey all,

I just released an early version (0.6) of israfil-mail-service - a simple mail sending service with a pluggable transport (currently implemented using javax.mail). You build a javax.mail.Session in your app module and as long as such exists, the JavaMailTransportService will pick it up. I added auto-loading to the two dependencies.

At this point there's little examples or documentation - I'll be adding them in a few days, and it only currently supports plaintext mail and javamail as a transport, but I've built it in a modular enough way that adding more transports (such as the Google Application Engine mailer, etc.) should be plug-and-play.

It's not substantially different than the service in spring- context-support, but I didn't want all the extra unrelated dependencies on Spring, as well as the over-complication. I'll probably add templating too (spring's uses velocity, but I'll probably make it pluggable), but that's lower on my list.

The project is at http://code.google.com/p/israfil-mail-service and is licensed under BSD.

I considered putting it in the Tapestry360, but realized this is general purpose and I can use it in pico-container or GUICE or Spring just as easily (though I wouldn't bother using in spring because of the extant service).

For the maven mavens out there, using it is pretty easy. Add this to your pom.xml file:

                <dependency>
                        <groupId>net.israfil.services.mail</groupId>
                        <artifactId>israfil-mail-service-javamail</artifactId>
                        <version>0.6</version>
                </dependency>
                <dependency>
                        <groupId>net.israfil.services.mail</groupId>
                        <artifactId>israfil-mail-service-api</artifactId>
                        <version>0.6</version>
                </dependency>

and implement something like this in your AppModule.java:

public static javax.mail.Session buildJavaMailSession() throws NamingException {
       InitialContext cxt = new InitialContext();
javax.mail.Session session = (javax.mail.Session) cxt.lookup( JNDI_PREFIX + "/" + MAIL_SESSION );

       if ( session == null ) {
           throw new NamingException("javax.mail.Session not found!");
       }
       return session;
   }

(or manually build a session if you're not declaring it in a JNDI configuration)

And that's it. You create an SMTPMessage, setSubject(), setBody, etc. The unit tests provide some sample code for building messages, but I'll make better docs, as I said, over the next few days. There's a few inconsistencies I want to iron out in the API, so don't consider it stable yet, though it's certainly usable - I'm moving it into production later today or tomorrow to provide some notification on a site. I've tested it with T5.1, not T5, but it accidentally picked up the T5.0.18 jars at one point and seemed to have little problem, so I expect it'll work.

cheers,
Christian.

Christian Edward Gruber
e-mail: [email protected]
weblog: http://www.geekinasuit.com/


Christian Edward Gruber
e-mail: [email protected]
weblog: http://www.geekinasuit.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to