Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Programmatically sending emails using IMailerService

I've been trying to send emails programmatically using IMailerService but its not working for some reason. The email notification is enabled and the jazz server is sending emails. I verified that by sending out team invitations, so the smtp server appears to be in order.

However, when I try to send an email programmatically through a simple snippet of code, it does not work. I tried writing the exception (if any) to a file, but turns out ... it never throws an exception either, since I cant find the file on the server. Here's the code:


try {
IMailerService mailerService = getService(IMailerService.class);
mailerService.sendMail(mailerService.getDefaultSender(), "<my-email-here>", "Jazz Test Email", "Test", "<some-cc-address-here>");
} catch (MessagingException e) {
// write to a file
try
{
java.io.FileWriter writer = new java.io.FileWriter("myfile.txt");
java.io.BufferedWriter out = new java.io.BufferedWriter(writer);
out.write(e.getMessage());
out.close();
writer.close();
}
catch (IOException ex)
{
ex.printStackTrace();
}
}


Thanks!

0 votes



One answer

Permanent link
I've been trying to send emails programmatically using IMailerService but its not working for some reason. The email notification is enabled and the jazz server is sending emails. I verified that by sending out team invitations, so the smtp server appears to be in order.
Thanks!


You have to turn email on in your local workspace. A co-worker sent me these instructions below:

By default, email is not enabled in the RTC development test server (Jetty/Derby) environment. These instructions show how to enable email:


1) Open your server (OSGi Framework) launch configuration. Go to the Arguments tab. Add the text for a new parameter below... make sure you do NOT add any newline characters... just use spaces to separate each VM argument.

-Dcom.ibm.team.server.configURL=file:///{$target_home}/../../server/teamserver.properties

2) Open <RTC>\jazz\server\teamserver.properties in a text editor:

3) Add the following lines to the bottom of the file:

com.ibm.team.repository.notification.mail.enabled=true
com.ibm.team.repository.notification.mail.from_name=jazzdev@us.ibm.com
com.ibm.team.repository.notification.mail.from=jazzdev@us.ibm.com
com.ibm.team.repository.notification.mail.smtp.server=relay.us.ibm.com
com.ibm.team.repository.notification.mail.reply=noreply-jazzdev@us.ibm.com


Good luck!

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,952

Question asked: Apr 01 '09, 12:23 a.m.

Question was seen: 6,535 times

Last updated: Apr 01 '09, 12:23 a.m.

Confirmation Cancel Confirm