/*
- * Copyright (C) 2016 Roland Haeder
+ * Copyright (C) 2016 Roland Häder
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/**
* An email class for sending out mails from templates
* <p>
- * @author Roland Haeder<roland@mxchange.org>
+ * @author Roland Häder<roland@mxchange.org>
*/
public abstract class BaseMailer implements DeliverableEmail {
/**
* 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;
message.setHeader("MIME-Version", "1.0"); //NOI18N
message.setHeader("Content-Type", "text/plain; charset=UTF-8"); //NOI18N
message.setHeader("Content-Transfer-Encoding", "8bit"); //NOI18N
- message.setHeader("Errors-To", this.properties.getProperty("mailer.errorsto")); //NOI18N
+
+ // Is property "errorsto" set ?
+ if ((this.properties.containsKey("mailer.errorsto")) && (!this.properties.getProperty("mailer.errorsto").isEmpty())) { //NOI18N
+ // Use this
+ message.setHeader("Errors-To", this.properties.getProperty("mailer.errorsto")); //NOI18N#
+ }
// Is the property "bouncesto" set?
- if (this.properties.containsKey("mailer.bouncesto")) { //NOI18N
+ if ((this.properties.containsKey("mailer.bouncesto")) && (!this.properties.getProperty("mailer.bouncesto").isEmpty())) { //NOI18N
// Use this
message.setHeader("Bounces-To", this.properties.getProperty("mailer.bouncesto")); //NOI18N
- } else {
- // Use "errorsto"
- message.setHeader("Bounces-To", this.properties.getProperty("mailer.errorsto")); //NOI18N
}
// Is the property "xloop" set?
- if (this.properties.containsKey("mailer.xloop")) { //NOI18N
+ if ((this.properties.containsKey("mailer.xloop")) && (!this.properties.getProperty("mailer.xloop").isEmpty())) { //NOI18N
// Use this
message.setHeader("X-Loop", this.properties.getProperty("mailer.xloop")); //NOI18N
- } else {
- // Use "errorsto"
- message.setHeader("X-Loop", this.properties.getProperty("mailer.errorsto")); //NOI18N
}
// Directly send email