Jeff Faath wrote on Sep 24, 2009 20:38:
Is there any way to hook into the method that sends the email? Is there an event that fires after an email is successfully sent? Any ideas on how this might be done?
Not really, and there are no events. You could do two things:
- use JavaMail directly (do not use Seam mail)
- write and install your own javax.mail.Transport that stores the mail before sending it. Look at Seam's MockTransport for ideas.
Thanks, I'll give #2 a shot. I don't want to give up on the great templating functionality that Seam mail provides.
Quick question regarding option two. Is there an example of how install my own transport? The api doc for MockTransport says to set the session transport property to mock. From what I've read about JavaMail, I need to add my transport to the provider registry. Is this done with MockTransport and if so, is there a code example floating around in the distribution?
The details about how to install a transport are somewhere in the JavaMail API reference, most probably
the Session class. Also look at JavaMail. IIRC, you need to put a
javamail.providers property file in your META-INF.
As for MockTransport, search for javamail.providers in the Seam source, should be somewhere there.