cancel
Showing results for 
Search instead for 
Did you mean: 

Email action to multiple recipients

bengrah
Champ on-the-rise
Champ on-the-rise
Hi all.

I'm working on a Javascript that basically notifies a set of users when document(s) come into a folder. And I'm just using the basic action script action found in on the Wiki to do it.

   var mail = actions.create("mail");
   mail.parameters.to = "davidc@alfresco.com";
   mail.parameters.subject = "Hello from JavaScript";
   mail.parameters.from = "davidc@alfresco.com";
   mail.parameters.template = root.childByNamePath("Company Home/Data Dictionary/Email Templates/notify_user_email.ftl");
   mail.parameters.text = "some text, in case template is not found";
   // execute action against a document   
   mail.execute(doc);

What I'd like to know is, is it possible to add multiple recipients to this action? For example:

mail.parameters.to = "davidc@alfresco.com; test@alfresco.com";

I have tried this approach before and it didn't work, so in the end I had to resort to a method call and run the same block of code multiple times depending on how many people I want to email. Any have any ideas?

Thanks,
Ben.
4 REPLIES 4

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Hi Ben,

I know you asked that question a while ago and I guess you found the answer to it, but for anyone else wondering the same here is the answer.

There's another parameter for the "mail" function that hold various recipients and it's an alternative to the "to" parameter. It's the to_many parameter.

The value passed to that parameter can be a group or an array of person objects.

Hope this helps,

Adei

bengrah
Champ on-the-rise
Champ on-the-rise
Hi Ben,

I know you asked that question a while ago and I guess you found the answer to it, but for anyone else wondering the same here is the answer.

There's another parameter for the "mail" function that hold various recipients and it's an alternative to the "to" parameter. It's the to_many parameter.

The value passed to that parameter can be a group or an array of person objects.

Hope this helps,

Adei

Hi Adei, actually I didn't find the answer to this so thank you very much for that!

Cheers,
Ben.

amandaluniz_z
Champ on-the-rise
Champ on-the-rise
Smiley Happy

Hope it worked

michaelc
Champ on-the-rise
Champ on-the-rise
Would this work the same in wcmqs ?
thinking I want to override the write.post.js module.
I expect it will.