10 Replies Latest reply on Apr 14, 2009 10:24 PM by ivanlatysh

    HTML Formatted Emails

    bradsdavis

      I am working on HTML emails. This would be for stylized emails within companies.

      The first stab is: org.jbpm.pvm.internal.email.producer.impl.HtmlScriptMailProducer.java within the email_branch.

      The class allows a user to populate the field "html", and will run through the HTML embedding images into the message as attachments, replacing URLs for the images with cid: references.

      Also, this extends the Script Email Producer, which allows the subject, body, and now HTML to resolve fields using the ScriptManager from jBPM.

      I would like to add template support for emails [both HTML and non-HTML emails]. I am currently looking at alternatives to the JBPM 3.x email template implementation. While the 3.x solution worked quite well for textual emails, I would like to package templates such that rich templates containing images and HTML could be available to JBPM.

      Has anyone given any thought to how to package rich templates in JBPM yet?

        • 1. Re: HTML Formatted Emails
          kukeltje
          • 2. Re: HTML Formatted Emails
            kukeltje

            Sorry, you talk about packaging.... No, that has not been discussed yet... but I think it should not be any different from how other things like actionhandler are loaded.... So things can be versioned as well.

            • 3. Re: HTML Formatted Emails
              aguizar

              Considering that HTML is text as well, the problem is media inserts like pictures. These could come from either the process archive itself or an absolute URL. We could consider any relative URL as a process archive reference. Any other sources we should consider?

              • 4. Re: HTML Formatted Emails
                kukeltje

                 

                "alex.guizar@jboss.com" wrote:
                Considering that HTML is text as well, the problem is media inserts like pictures. These could come from either the process archive itself or an absolute URL. We could consider any relative URL as a process archive reference. Any other sources we should consider?


                I would not just have the process archive as a reference. The webarchive/ear/AS classpath should be one as well. Hiarchical just like with actionhandlers

                The difficulty we encountered once is images from css (e.g. background etc). Those needed real file references afaik. I'm just not sure anymore if that was the apache mail component or the sun 'flyingsaucer' html->pdf renderer (would be a nice addition though)

                • 5. Re: HTML Formatted Emails
                  aguizar

                   

                  "kukeltje" wrote:
                  The webarchive/ear/AS classpath should be one as well. Hierarchical just like with actionhandlers

                  Right. We can use relative URLs for this as well. If the resource is not present in the archive we look in the classpath using the context class loader.
                  As an alternative, we can use a classpath: prefix as in Spring.
                  classpath:some/resource/path/myTemplate.txt

                  The difficulty we encountered once is images from css (e.g. background etc). Those needed real file references afaik. I'm just not sure anymore if that was the apache mail component or the sun 'flyingsaucer' html->pdf renderer (would be a nice addition though)

                  We can deal with more specific problems like this later on, or count on the help of someone in the community -wink, wink-.

                  • 6. Re: HTML Formatted Emails
                    kukeltje

                     

                    The difficulty we encountered once is images from css (e.g. background etc). Those needed real file references afaik. I'm just not sure anymore if that was the apache mail component or the sun 'flyingsaucer' html->pdf renderer (would be a nice addition though)

                    We can deal with more specific problems like this later on

                    • 7. Re: HTML Formatted Emails
                      kukeltje

                      sorry, wrong quoting... I said: I agree

                      • 8. Re: HTML Formatted Emails
                        bradsdavis

                        @alejandro, the only thing I dont like about the classpath directive is that if you are designing email templates in a WYSIWYG editor, I would imagine that would complicate things.

                        Otherwise, that would be helpful when parsing. I like the idea about possibly packaging them with process definitions.

                        One option would be to specify a directory within the jbpm configuration where templates will be read from. I can then reference templates relative to that directory, which would be easy to accomplish.

                        • 9. Re: HTML Formatted Emails
                          aguizar

                           

                          "bradsdavis" wrote:
                          One option would be to specify a directory within the jbpm configuration where templates will be read from. I can then reference templates relative to that directory, which would be easy to accomplish.

                          You mean a local directory? I don't believe that would be a good idea. The process archive, the classpath, the configuration file and an absolute URL are all locations we can rely upon at runtime.

                          • 10. Re: HTML Formatted Emails
                            ivanlatysh

                             

                            "bradsdavis" wrote:
                            I would like to add template support for emails [both HTML and non-HTML emails]. I am currently looking at alternatives to the JBPM 3.x email template implementation.


                            If you are looking for an alternative to email generation, have a look at http://code.google.com/p/saxon-extensions/wiki/EmailEmitterJbossExample Email Emitter extension for Saxon.