]> WPIA git - gigi.git/commitdiff
FIX: minor errors in email
authorFelix Dörre <felix@dogcraft.de>
Mon, 22 Sep 2014 18:40:18 +0000 (20:40 +0200)
committerFelix Dörre <felix@dogcraft.de>
Mon, 22 Sep 2014 18:40:18 +0000 (20:40 +0200)
src/org/cacert/gigi/email/EmailProvider.java
src/org/cacert/gigi/email/Sendmail.java

index 3e6d3493acc317c4272ec14a845b1cb19f0d7f39..64902429c6d611547d3cb76c2e21d24d1b09ee3d 100644 (file)
@@ -77,6 +77,12 @@ public abstract class EmailProvider {
             }
 
             for (String host : mxhosts) {
+                host = host.split(" ", 2)[1];
+                if (host.endsWith(".")) {
+                    host = host.substring(0, host.length() - 1);
+                } else {
+                    return "Strange MX records.";
+                }
                 try (Socket s = new Socket(host, 25); BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter pw = new PrintWriter(s.getOutputStream())) {
                     String line;
                     while ((line = br.readLine()) != null && line.startsWith("220-")) {
index 601130500e96719c1fe913db1b61f7240a5dd94d..1eb1d914f4750444d0bdf3c47d2d0b66965974fc 100644 (file)
@@ -52,8 +52,10 @@ public class Sendmail extends EmailProvider {
         // TODO
         SimpleDateFormat emailDate = new SimpleDateFormat("E, d MMM yyyy HH:mm:ss ZZZZ (z)", Locale.ENGLISH);
         out.print("Date: " + emailDate.format(new Date(System.currentTimeMillis())) + "\r\n");
-        out.print("Sender: " + errorsto + "\r\n");
-        out.print("Errors-To: " + errorsto + "\r\n");
+        if (errorsto != null) {
+            out.print("Sender: " + errorsto + "\r\n");
+            out.print("Errors-To: " + errorsto + "\r\n");
+        }
         if (replyto != null) {
             out.print("Reply-To: " + replyto + "\r\n");
         } else {