/**
* Properties for this mailer
* <p>
- * Valid are: - mailer.errorsto = Email address for "Errors-To" header -
- * mailer.bouncesto = Email address for "Bounces-To" header (optional, if
- * not set, errorsto must be set) - mailer.xloop = Email address for
- * "X-Loop" header (optional, if not set, errorsto must be set)
+ * Valid are:
+ * - mailer.errorsto = Email address for "Errors-To" header
+ * - mailer.bouncesto = Email address for "Bounces-To" header (optional, if not set, errorsto must be set)
+ * - mailer.xloop = Email address for "X-Loop" header (optional, if not set, errorsto must be set)
*/
private Properties properties;
return this.templateEngine;
}
+ @Override
+ public void init (final Properties properties) {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("init: properties={0} - CALLED!", properties)); //NOI18N
+
+ // Are all required properties set?
+ if (null == properties) {
+ // Is null
+ throw new NullPointerException("properties is null"); //NOI18N
+ } else if (!properties.containsKey("mailer.errorsto")) { //NOI18N
+ // Errors-To not set
+ throw new IllegalArgumentException("properties.mailer.errorsto is not set"); //NOI18N
+ } else if (!properties.containsKey("mailer.bouncesto")) { //NOI18N
+ // Errors-To not set
+ throw new IllegalArgumentException("properties.mailer.bouncesto is not set"); //NOI18N
+ }
+
+ // Set it here
+ this.properties = properties;
+
+ // Trace message
+ this.getLoggerBeanLocal().logTrace("init: EXIT!"); //NOI18N
+ }
+
/**
* Sends an email to given email address with subject line.
* <p>
* @throws MessagingException If something happened on message delivery
*/
private void sendMail (final Address emailAddress, final String subjectLine, final String body, final Session mailSession) throws MessagingException {
+ // Trace message
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("sendMail: emailAddress={0},subjectLine={1},body={2},mailSession={3} - CALLED!", emailAddress, subjectLine, body, mailSession)); //NOI18N
+
+ // Are the additional properties set?
+ if (null == this.properties) {
+ // Nothing set
+ throw new NullPointerException("this.properties is null"); //NOI18N
+ }
+
// Get MIME message instance
MimeMessage message = new MimeMessage(mailSession);
} else if (emailWrapper.getTemplateName().isEmpty()) {
// Is empty
throw new IllegalArgumentException("emailWrapper.templateName is empty"); //NOI18N
- } else if (emailWrapper.getLocale()== null) {
+ } else if (emailWrapper.getLocale() == null) {
// Throw NPE again
throw new NullPointerException("emailWrapper.locale is null"); //NOI18N
}