Skip to content

Instantly share code, notes, and snippets.

@amusarra
Created October 7, 2013 21:11
Show Gist options
  • Save amusarra/6875020 to your computer and use it in GitHub Desktop.
Save amusarra/6875020 to your computer and use it in GitHub Desktop.
SubscriptionSender subscriptionSender = new SubscriptionSender();
subscriptionSender.setSubject("Lista degli utenti disattivati");
subscriptionSender.setBody(emailBody.toString());
subscriptionSender.setUserId(user.getUserId());
subscriptionSender.setCompanyId(user.getCompanyId());
subscriptionSender.setFrom("[email protected]", "Liferay Portal");
subscriptionSender.setHtmlFormat(false);
subscriptionSender.setMailId("user", user.getUserId());
subscriptionSender.addRuntimeSubscribers(
user.getEmailAddress(),
user.getFullName());
List<EmailAddress> emails = (List<EmailAddress>) user.getEmailAddresses();
if (emails.size() > 0) {
if (_log.isInfoEnabled()) {
_log.info("User " + user.getUserId() +
" has additional emails address");
}
for (EmailAddress emailAddress : emails) {
subscriptionSender.addRuntimeSubscribers(
emailAddress.getAddress(),
(String) user.getFullName());
}
}
subscriptionSender.flushNotificationsAsync();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment