The community will undergo maintenance on October 16th at 10:00 PM PDT and will be unavailable for up to one hour.
Solved! Go to Solution.
Do you just need the address? Try this:
((WTUser)localWTPrincipal).getEMail()).getAddress();
Do you just need the address? Try this:
((WTUser)localWTPrincipal).getEMail()).getAddress();
Thank you @avillanueva for the quick reply.
As I am using Article - CS63309 to send email notifications, but am not able to receive any emails.
Does it require any configuration before using the customization provided in the article?
This is a snippet I use to create my own workflow task notification email. I know that general email notifications might vary slightly but they all use a template. Does this help? Aside from receiving emails, you can check that the queue is actually creating the notification. If you stop the queue, you can see if it indeed is being queued up to send an email. If you restart the queue, the task will disappear after its processed and the email should be on its way. Unless there is something outside of the system that is not delivering it. Sry for simple question but have you verified that other emails are being send from system properly and just not these custom ones?
WTDistributionList distroList = new WTDistributionList();
Persistable p = null;
if ((workItem.getPrimaryBusinessObject() != null) && (workItem.getPrimaryBusinessObject().toString() != null))
p = workItem.getPrimaryBusinessObject().getObject();
if (AccessControlHelper.manager.hasAccess(user.getPrincipal(), p, AccessPermission.READ)) {
LOGGER.debug("adding " + user.getDisplayName() + " to distribution.");
distroList.addPrincipal(user.getPrincipal());
}
TemplateEmailNotification email = new TemplateEmailNotification(distroList);
Object[] arrayOfObject = new Object[5];
arrayOfObject[0] = activity.getName();
email.setSubjectResource("wt.workflow.work.workResource");
email.setSubjectMessageKey("124");
email.setSubjectInserts(arrayOfObject);
//PDML-10 - Improved email templates showed call out of template processor was incorrect.
WfTaskNotificationProcessor processor = new WfTaskNotificationProcessor(workItem);
//processor.setWorkItem(workItem);
email.setTemplateProcessor(processor);
email.setTemplate(TemplateName.getWorkNotification("General"));
//processor.setState(new TemplateProcessorState());
String str = "";
try {
str=WTProperties.getLocalProperties().getProperty("wt.notify.notificationSenderEmail");
}
catch (IOException e) {}
WTPrincipal localWTPrincipal = activity.getParentProcess().getCreator().getPrincipal();
if (localWTPrincipal instanceof WTUser) {
try {
str = new InternetAddress(((WTUser)localWTPrincipal).getEMail()).getAddress();
}
catch (NullPointerException nullE) {}
catch (Exception e)
{
LOGGER.debug("Exception while creating IntenetAddress==>");
}
LOGGER.debug("Sender:" + str);
}
email.setSender(str);
LOGGER.debug("Created email, returning.");
return email;
Thank you @avillanueva for the suggestion.
Basically, I need to configure the SMTP configuration first.