AnsweredAssumed Answered

How send an Email to many 'external users' using MailAction

Question asked by angello0571 on Nov 23, 2012
Latest reply on Nov 26, 2012 by angello0571
Hello,

I tried to use the MailAction, it only recieves a list of users's usernames or groups. For Example:

 this.serviceRegistry = AlfrescoServiceUtil.getServiceRegistry();
      List<String> users = new ArrayList<String>();
      users.add("user1");
      users.add("user2");
      ActionService actionService = serviceRegistry.getActionService();
      Action mailAction = actionService.createAction(MailActionExecuter.NAME);
      mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "My Subject");
      mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, "someone@gmail.com");
      mailAction.setParameterValue(MailActionExecuter.PARAM_TO_MANY, (Serializable) users);
      mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, "Hello!");
      actionService.executeAction(mailAction, null);

That code works perfect, but I would like to send an email to a list of email adresses (they don't live into Alfresco as users or groups, they are external). Is there any way to do something like this?:

 this.serviceRegistry = AlfrescoServiceUtil.getServiceRegistry();
      List<String> users = new ArrayList<String>();
      users.add("extarnaladress1@hotmail.com");
      users.add("extarnaladress2@gmail.com");
      ActionService actionService = serviceRegistry.getActionService();
      Action mailAction = actionService.createAction(MailActionExecuter.NAME);
      mailAction.setParameterValue(MailActionExecuter.PARAM_SUBJECT, "My Subject");
      mailAction.setParameterValue(MailActionExecuter.PARAM_FROM, "someone@gmail.com");
      mailAction.setParameterValue(MailActionExecuter.PARAM_TO_MANY, (Serializable) users);
      mailAction.setParameterValue(MailActionExecuter.PARAM_TEXT, "Hello!");
      actionService.executeAction(mailAction, null);

Or do how I can extend the API to do it ?

Outcomes