bugfixes
[org.ibex.mail.git] / src / org / ibex / mail / protocol / SMTP.java
index 4b0ea72..e39eca0 100644 (file)
@@ -39,7 +39,7 @@ public class SMTP {
                     println("250 " + (from = new Address(command.substring(10).trim())) + " is syntactically correct");
                 } else if (c.startsWith("RCPT TO:")) {
                     if (from == null) { println("503 MAIL FROM must precede RCPT TO"); continue; }
-                    command = command.substring(9).trim();
+                    command = command.substring(8).trim();
                     if(command.indexOf(' ') != -1) command = command.substring(0, command.indexOf(' '));
                     Address addr = new Address(command);
                     InetAddress[] mx = getMailExchangerIPs(addr.host);
@@ -142,7 +142,7 @@ public class SMTP {
                 Log.setThreadAnnotation("[outgoing smtp] ");
                 Log.info(SMTP.Outgoing.class, "outgoing thread started; " + spool.count(Query.all()) + " messages to send");
                 while(true) {
-                    for(Mailbox.Iterator it = spool.iterator(); it.cur() != null; it.next())
+                    for(Mailbox.Iterator it = spool.iterator(); it.next(); )
                         try                   { if (attempt(it.cur())) it.delete(); }
                         catch (IOException e) { Log.error(SMTP.Outgoing.class, e); }
                     synchronized(Outgoing.class) {