Multiple emails with “to” and “CC” Alfresco 5.2

cancel
Showing results for 
Search instead for 
Did you mean: 
charlenecart12
Member II

Multiple emails with “to” and “CC” Alfresco 5.2

We have a question for Alfresco 5.2 Using javascript (API) we want to send some emails for a CronJobs that we are developing. We have seen that if we use "mail.parameters.to_many" we cannot send "CC".

We need to send MyLowesLife

To: "email1@xxx.com", "email2@xxx.com"

cc: "email3@xxx.com"

If we use:

mail.parameters.to = "email1@xxx.com"
mail.parameters.cc = "email3@xxx.com"

we correctly receive the "to" and the "CC"

But if we use:

mail.parameters.to_many = ["email1@xxx.com", "email2@xxx.com"]
mail.parameters.cc = "email3@xxx.com"

We received in the "to" "email1@xxx.com", "email2@xxx.com" but "CC" empty.

How can you send multiple emails "to" with "CC"? Example with "to" and "CC":

var subj= "prueva de multiples";
var mail = actions.create("mail");
mail.parameters.to ="email1@xxx.com";
mail.parameters.cc = "email3@xxx.com";
mail.parameters.subject = subj;
mail.parameters.from = "serverMail.com"; 
mail.parameters.text = "This test is OK";
mail.executeAsynchronously(node);

(Works correctlym It works fine, but a "to" and a "CC")

Example 2:

var subj= "prueva de multiples";
var mail = actions.create("mail");
var emails = ["email1@xxx.com","email2@xxx.com","email3@xxx.com"];
mail.parameters.to_many = emails;
mail.parameters.cc = ""email4CC@xxx.com";
mail.parameters.subject = subj;
mail.parameters.from = "serverMail.com"; 
mail.parameters.text = "This test is not Ok";
mail.executeAsynchronously(node);

(Sends the "to_many", but the "CC" does not send it)

We want to send multiple emails in "to" and multiple in "CC".

The most important thing for us is to be able to send one "to" and multiple "CC"

Thanks guys

2 Replies
afaust
Master

Re: Multiple emails with “to” and “CC” Alfresco 5.2

Unfortunately Alfresco's default mail action really does not support that case. Only when "to" is not set, "to_many" will be used - and in that case "cc" and "bcc" are completely ignored. There is no point in argueing whether this is sensible or not (it is not in my opinion) as this functionality has always been this broken, and won't ever change. In fact, this is one of the reasons I recently created my own variant of the mail action in a customer project in which I needed to handle various notifications. My variant allows for "to" to be either a single address or multiple, the same for "cc" and "bcc".

jpotts
Professional