6 Replies Latest reply on May 26, 2006 9:51 PM by ssquare

    send mail activity

    ssquare

      Hi,

      Could anyone post skeleton code to provide sendmail activity in the process definition? Does this action needs to be supported by the JBOSS MailServices configuration as well?


      Thanks in advance.

      Regards
      ssquare

        • 1. Re: send mail activity
          koen.aers

          Have a peek in the CVS. There is an implementation of the mail node already for the upcoming 3.2 releases AFAIK. You could implement such an action for any mailserver.

          Regards,
          Koen

          • 2. Re: send mail activity
            walterim

             

            try{
             SimpleEmail email=new SimpleEmail();
             final String nomeEtapa=context.getAction().getEvent().getGraphElement().getName();
             email.setSubject("Etapa completada: "+nomeEtapa);
             email.setFrom("workflow@tcc");
             email.addTo("walter@tcc");
             email.setHostName("120.120.1.127");
             email.setMsg("Etapa completada: "+nomeEtapa+"\n"+
             "Projeto: "+context.getVariable("projeto")+"\n"+
             "Caso de uso: "+context.getVariable("casoDeUso"));
             email.send();
             }
             catch(Exception e){
             e.printStackTrace();
             }

            I extracted this sample from a academic research I'm doing. You should add javamail and commons mail to you project.

            Good luck,

            Walter Mourão

            • 3. Re: send mail activity
              walterim

              I forgot to say that the code is inside an Action Handler.

              • 4. Re: send mail activity
                ssquare

                Thanks eveyone for your input.

                Regards
                -Siv

                • 5. Re: send mail activity
                  ssquare

                  Hi,

                  I am able to use this snippet in a standalone java app and it works fine.

                  When I added this into the taskBean.java (bean for handling actions saveandclose in task.jsp) ,

                  public String saveAndClose() {

                  :
                  :

                  try{
                  SimpleEmail email=new SimpleEmail();

                  email.setSubject("NEW TASK TEST);
                  email.setFrom("s@abc.com");
                  email.addTo("t@abc.com");
                  email.setHostName("mail.abc.com");
                  email.setMsg("TESTING a NEW TASK SUBMISSION"));
                  email.send();
                  }
                  catch(Exception e){
                  e.printStackTrace();
                  }

                  :
                  :

                  it does not send any mail.

                  Any clue is apprreciated.

                  The only difference between standalone and jbpm env. is that the beans are deployed under JBOSS application server. coudl this be an issue?


                  Thanks
                  -Siv

                  • 6. Re: send mail activity
                    ssquare

                    Could any one send info on how to check 3.2 send mail implementation?

                    Thanks
                    -Shiv