do not challenge messages with no envelope-to or with an auto-submitted
[org.ibex.mail.git] / src / org / ibex / mail / Whitelist.java
index c8f54ea..06724fe 100644 (file)
@@ -119,8 +119,16 @@ public class Whitelist {
             if (to==null) to = m.from;
             if (to==null) to = m.envelopeFrom;
 
-            // FIXME
-            //if (to==null) return ibex.mail.drop("message is missing a to/replyto/envelopeto header; cannot accept");
+            if (m.envelopeTo==null || m.envelopeTo.equals("null") || m.envelopeTo.equals("")) {
+                Log.warn(this, "message is missing a to/replyto/envelopeto header; cannot accept");
+                return;
+            }
+            if (m.headers.get("Auto-Submitted") != null &&
+                m.headers.get("Auto-Submitted").toLowerCase().indexOf("auto-replied")!=-1) {
+                Log.warn(this, "refusing to send a challenge to a message "+
+                         "with Auto-Submitted=\""+m.headers.get("Auto-Submitted")+"\"");
+                return;
+            }
 
             Address from = Address.parse("adam@megacz.com");