Skip to content

Instantly share code, notes, and snippets.

@sdorra
Created December 20, 2012 06:56
Show Gist options
  • Save sdorra/4343398 to your computer and use it in GitHub Desktop.
Save sdorra/4343398 to your computer and use it in GitHub Desktop.
scm-mail-plugin usage example.
/**
*
* @author Sebastian Sdorra
*/
public class NotificationService
{
private static final Logger logger = LoggerFactory.getLogger(
NotificationService.class);
private MailService mailService;
@Inject
public NotificationService(MailService mailService)
{
this.mailService = mailService;
}
public void sendNotification() throws MailSendBatchException {
if ( mailService.isConfigured() ){
Email mail = new Email();
mail.setFromAddress("SCM-Administrator", "[email protected]");
mail.addRecipient("Test User", "[email protected]", RecipientType.TO);
mail.setSubject("SCM-Manager notification");
mail.setText("Notification from SCM-Manager");
mailService.send(mail);
} else {
logger.warn("mail service is not configured");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment