]> git.mxchange.org Git - jmailer-ee.git/commitdiff
Continued a bit:
authorRoland Häder <roland@mxchange.org>
Wed, 31 Aug 2016 14:53:22 +0000 (16:53 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 31 Aug 2016 14:53:22 +0000 (16:53 +0200)
- 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?

src/org/mxchange/jmailee/model/delivery/BaseMailer.java

index 64cbf368f298aab785901333d7941146cb3af1e8..dee8ff4522e1dcd81fabc65ab16bf2d4700f1b00 100644 (file)
@@ -59,10 +59,10 @@ 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;
 
@@ -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