3 Replies Latest reply on Mar 13, 2008 11:52 AM by Emanuel Muckenhuber

    email to admin on user registration and activation confirm

    Denis Marzadro Novice

      i'm using
      - portal 2.6.4 boudled with jboss ap
      - oracle 9.2

      i'm trying to costomize the "subscription-mode". I'd like the "jbp_identity_validation_approval_workflow" but i would also like to send an email to a specific user (an admin user) when the request arrive and another one to the user on the admin activation.

      thanks in advance for every suggestions on the best way to do this

        • 1. Re: email to admin on user registration and activation confi
          Emanuel Muckenhuber Master

          For doing something like this you would need to provide your own jBPM Action and plug it into the process - for example like this:

          public class MyNotificationMailAction implements org.jbpm.graph.def.ActionHandler
           public void execute(ExecutionContext ectx) throws Exception
           // do something

          and in the process definition you would need to add this action on the transition you want it to be executed.
           <state name="validate_email">
           <transition name="validated" to="admin_approval">
           <action class="MyNotificationMailAction"/>

          This would execute the action after the email address is verified.
          For further information you can take a look at the jBPM documentation and the current implementation in JBoss Portal.

          • 2. Re: (to jboss people too) email to admin on user registratio
            Denis Marzadro Novice

            thanks, in fact i solved but didn't have time to post the solution, i'm sorry.

            Anyway, i found another little lack: i tried to use the template mail like into the portal but it wasn't possible without implement a custom IdentityMailService.

            The portal version check the "action" value passed and use it to find the template directory where "emailTemplate.tpl" is stored. It could be easy to add a new template simply adding the custom file tpl in a new directory and use the directory name as "action" itself, but the IdentityMailService throws a IllegalArgumentException (unknown template) because it doesn't find the action in the list it knows.
            I think it could be possible change the final "else" in order to use the "action" value as key of the subject (something like subject = bundle.getString(action) )
            I'm sorry I have no time to try now, perhaps in near future, i just hope it can be an interesting input for jboss people.


            • 3. Re: email to admin on user registration and activation confi
              Emanuel Muckenhuber Master

              yes i saw that too... Since yesterday this is possible in the 2.6 branch as you described it, although i'm not very convinced - need to think about that again, as there should be a at least a prefix for getting the subject from the bundle...

              Furthermore it will expose this method for more flexibility:

               IdentityMailService.send(String emailFrom, String emailTo, String subject, String emailBody);