3 Replies Latest reply on Jun 2, 2008 11:06 AM by Pete Muir

    Transaction safe mail sending

    Antal Viktor Newbie

      Hi,


      Is there a way to send mail only when the current transaction commits?




      Right now I use renderer.render("...") but when the call returns the mail is already sent.


      Because I could not find a way for transaction safe mail sending, I tried the following will as the second best:



      1. when I call renderer.render not send the mail just render the Message and store it in the database

      2. an asynchronous method checks this table and sends mail



      But I am stuck because:



      1. I do not know how to replace the transport with my implementation

      2. how to find the original when I send the mails

      3. how to serialize/deserialize the Message



      I appreciate any help.

      Thanks,

      Viktor