fixed a spam hole
[org.ibex.mail.git] / src / org / ibex / mail / protocol / SMTP.java
index d03c24e..32c25f6 100644 (file)
@@ -93,7 +93,8 @@ public class SMTP {
                     if (addr.isLocal()) {
                         // FEATURE: should check the address further and give 550 if undeliverable
                         conn.println("250 " + addr + " is on this machine; I will deliver it");
-                    } else if (conn.getRemoteAddress().isLoopbackAddress())
+                        to.addElement(addr);
+                    } else if (conn.getRemoteAddress().isLoopbackAddress()) {
                         conn.println("250 you are connected locally, so I will let you send");
                         to.addElement(addr);
                     } else {
@@ -101,7 +102,7 @@ public class SMTP {
                     }
                 } else if (c.startsWith("DATA")) {
                     //if (from == null) { conn.println("503 MAIL FROM command must precede DATA"); continue; }
-                    if (to == null) { conn.println("503 RCPT TO command must precede DATA"); continue; }
+                    if (to == null || to.size()==0) { conn.println("503 RCPT TO command must precede DATA"); continue; }
                     conn.println("354 Enter message, ending with \".\" on a line by itself");
                     conn.flush();
                     try {