Skip to content

Instantly share code, notes, and snippets.

@sdorra
Created December 20, 2012 06:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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", "admin@scm-manager.org");
mail.addRecipient("Test User", "test.user@scm-manager.org", 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