public class MailUtil extends TemplateUtil implements Logable
Created by Jeff Gaynor
on 10/5/11 at 1:18 PM
Modifier and Type | Class and Description |
---|---|
static class |
MailUtil.MailEnvironment |
Modifier and Type | Field and Description |
---|---|
static String |
ADDRESS_SEPARATOR
The separator between email addresses.
|
static String |
LEFT_DELIMITER
The left-hand delimiter for replacements in templates.
|
static String |
RIGHT_DELIMITER
The right-hand delimiter for replacements in templates.
|
REGEX_LEFT_DELIMITER, REGEX_RIGHT_DELIMITER
Constructor and Description |
---|
MailUtil() |
MailUtil(MailUtil.MailEnvironment me) |
MailUtil(MyLoggingFacade myLogger) |
Modifier and Type | Method and Description |
---|---|
void |
debug(String x)
Write a debug message to the log.
|
void |
error(String x)
Write an error message to the log.
|
MailUtil.MailEnvironment |
getMailEnvironment() |
String |
getMessageTemplate() |
MyLoggingFacade |
getMyLogger() |
Session |
getSession(Properties props) |
String |
getSubjectTemplate() |
void |
info(String x)
Write an informational message to the log
|
boolean |
isDebugOn()
Query if debugging is enabled for this logger.
|
boolean |
isEnabled() |
protected String |
readTemplate(String fileName) |
boolean |
sendMessage(Map replacements)
This takes a map of replacements for the templates and sends the message.
|
boolean |
sendMessage(String subjectTemplate,
String messageTemplate,
Map replacements)
This allows for sending with a specific subject and message template.
|
void |
setDebugOn(boolean debugOn)
Enable/disable debugging for this logger
|
void |
setMessageTemplate(String messageTemplate) |
void |
setMyLogger(MyLoggingFacade myLogger) |
void |
setSubjectTemplate(String subjectTemplate) |
void |
warn(String x)
Write a warning to the log.
|
main, newReplaceAll, oldReplaceAll, replaceAll, rr
public static String LEFT_DELIMITER
public static String RIGHT_DELIMITER
public static String ADDRESS_SEPARATOR
public MailUtil(MyLoggingFacade myLogger)
public MailUtil()
public MailUtil(MailUtil.MailEnvironment me)
public Session getSession(Properties props) throws NamingException
NamingException
public boolean isEnabled()
public MailUtil.MailEnvironment getMailEnvironment()
public boolean sendMessage(String subjectTemplate, String messageTemplate, Map replacements)
subjectTemplate
- messageTemplate
- replacements
- public boolean sendMessage(Map replacements)
This will return a true if the message succeeded and a false otherwise. It will not cause a failure outright, since a failed notification should not bring down your server.
replacements
- public String getMessageTemplate() throws IOException
IOException
public void setMessageTemplate(String messageTemplate)
public void setSubjectTemplate(String subjectTemplate)
public String getSubjectTemplate() throws IOException
IOException
protected String readTemplate(String fileName) throws IOException
IOException
public MyLoggingFacade getMyLogger()
public void setMyLogger(MyLoggingFacade myLogger)
public void debug(String x)
Logable
public void setDebugOn(boolean debugOn)
Logable
setDebugOn
in interface Logable
public boolean isDebugOn()
Logable
public void info(String x)
Logable
public void warn(String x)
Logable
Copyright © 2019. All Rights Reserved.