send a mail to a user list

Hello everyone,

I wish at the end of one of my tasks to send an email to two separate lists with different contents to the members of my organization.

During the execution of a human task I assign via a form to students a teacher as a supervisor (as a manager on bonita). At the end of this task, I would like to send an email to the students with their assigned supervisor and an email to the teachers with their list of students.

For the moment I have so far managed to send mails to single recipients (via smtp fake as on the tutorial) but when I assign a list of recipients in the "to:" field instead of a single recipient no mail is sent.

So I would like to know first how to assign several receiver in this field in order to make a multiple send and secondly how to specify in the body of the message that this student is assigned to this teacher.

Here is my code for retrieving the student list

import org.bonitasoft.engine.identity.Group
import org.bonitasoft.engine.identity.User
import org.bonitasoft.engine.identity.UserCriterion;

Group student = apiAccessor.getIdentityAPI().getGroupByPath(“/MY_ORGA_PATH/GROUP”)

List<User> students = apiAccessor.getIdentityAPI().getUsersInGroup(student.getId(), 0, 1000, UserCriterion.FIRST_NAME_ASC)

ArrayList<String> studentMails = new ArrayList<String>(students.size())

for(User user : students){
studentMails.add(BonitaUsers.getUserProfessionalContactInfo(apiAccessor, user.getId()).email)
}

return studentMails;

The expected format is a comma separated String for multiple addresses.

Try

return studentMails.join(',')

HTH

Romain

Edit: I made a PR to improve the user guidance (https://github.com/bonitasoft/bonita-connector-email/pull/5)

It works thank you laugh