It's all about the answers!

Ask a question

Send Email for Java API


Pankaj Sharma (40347) | asked Jan 27 '16, 10:55 a.m.
edited Jan 27 '16, 10:55 a.m.
 Hello Team,
I am trying to send email using Java API in follow-up action, but i am getting following compile time error on mymailerService.sendMail()
The type javax.mail.MessagingException cannot be resolved. It is indirectly referenced from required .class files

I am using the following code:
IMailerService mymailerService = getService(IMailerService.class);
MailSender sender = mymailerService.getDefaultSender();
if(mymailerService.isMailEnabled()){
System.out.println("RTC Mail Service is ENABLED!!");
mymailerService.sendMail(sender, contributor.getEmailAddress(), "Test Notification: Dependent WorkItem", "Hello. The dependent work Item is completed", ""); 
} else {
System.out.println("RTC Mail Service is Not ENABLED!!");
}

I have updated pre requisits in plugin.xml as well

<prerequisites>
               <requiredservice interface="com.ibm.team.repository.service.IRepositoryItemService" /> 
  <requiredservice interface="com.ibm.team.workitem.common.IWorkItemCommon" />
   <requiredservice interface="com.ibm.team.repository.service.IMailerService" /> 
            </prerequisites>
Please help me, Thanks in advance

One answer



permanent link
Ralph Schoon (59.0k23642) | answered Jan 27 '16, 11:04 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You are missing some dependencies in the meta.inf. See Due Date Notifier – an Asynchronous Task Example for the dependencies that did it for me.

Your answer


Register or to post your answer.