Skip to main content

Email Service

Wrapper for the '/email' APIs.

List of all options:

  • Send custom email
  • Send email to a user
  • Send email to the group members

Initialize service

    TrivoreID sdk = TrivoreID.mgmtApiClient();
EmailServiceImpl emailService = new EmailServiceImpl(sdk.emailService());

Simple email message

EmailMessage message = new EmailMessage();
message.setTo(Arrays.asList(new Email("[email protected]"),
new Email("[email protected]"),
new Email("[email protected]")));
message.setSubject("Example Subject");
message.setText("Example text body.");

emailService.send(message);

Send email to a user by user ID

EmailMessage message = new EmailMessage();
message.setSubject("Example Subject");
message.setText("Example text body.");

emailService.sendToUser(message, "userID");

Send email to all group members

Sending email to all primary (first) email addresses of users that belong to the defined groups.

EmailMessage message = new EmailMessage();
message.setSubject("Example Subject");
message.setText("Example text body.");

// This will send email message to all members of the groups (can be group IDs or names).
// If the group was not found within defined namespace, then the warning message will be logged.
// The maximum number of groups is 20 due to the limited length of the URL.
emailService.sendToGroupMembers(message, "nsCode", "group001", "group002", "group003");

Email Service Models

Email

EmailAddress

EmailAttachments