From d60a425fbe5d67732d4e2b5275d496c47c36b474 Mon Sep 17 00:00:00 2001 From: Guillaume Sauthier <guillaume.sauthier@peergreen.com> Date: Mon, 05 Nov 2012 11:30:06 -0500 Subject: [PATCH] HTML email notification methods and hook (pull request #51) --- src/com/gitblit/GitBlit.java | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index 0d37b44..32f4c47 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -2658,6 +2658,37 @@ } /** + * Notify users by email of something. + * + * @param subject + * @param message + * @param toAddresses + */ + public void sendHtmlMail(String subject, String message, Collection<String> toAddresses) { + this.sendHtmlMail(subject, message, toAddresses.toArray(new String[0])); + } + + /** + * Notify users by email of something. + * + * @param subject + * @param message + * @param toAddresses + */ + public void sendHtmlMail(String subject, String message, String... toAddresses) { + try { + Message mail = mailExecutor.createMessage(toAddresses); + if (mail != null) { + mail.setSubject(subject); + mail.setContent(message, "text/html"); + mailExecutor.queue(mail); + } + } catch (MessagingException e) { + logger.error("Messaging error", e); + } + } + + /** * Returns the descriptions/comments of the Gitblit config settings. * * @return SettingsModel -- Gitblit v1.9.1