From 0a81aae333af238ec057212b874005af603b10d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 31 Aug 2016 16:53:22 +0200 Subject: [PATCH] Continued a bit: - all headers such as Errors-To, Bounces-To and X-Loop should be optional, not even mailer.errorsto must be set - this allows lazay administrators/webmaster but hey ... if they really don't care? --- .../jmailee/model/delivery/BaseMailer.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/org/mxchange/jmailee/model/delivery/BaseMailer.java b/src/org/mxchange/jmailee/model/delivery/BaseMailer.java index 64cbf36..dee8ff4 100644 --- a/src/org/mxchange/jmailee/model/delivery/BaseMailer.java +++ b/src/org/mxchange/jmailee/model/delivery/BaseMailer.java @@ -59,10 +59,10 @@ public abstract class BaseMailer implements DeliverableEmail { /** * Properties for this mailer *

- * 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; @@ -154,24 +154,23 @@ public abstract class BaseMailer implements DeliverableEmail { 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 -- 2.39.5