From: Roland Häder Date: Wed, 31 Aug 2016 14:53:22 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0a81aae333af238ec057212b874005af603b10d9;p=jmailer-ee.git 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? --- 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