added preliminary mailing list support
[org.ibex.mail.git] / src / org / ibex / mail / Message.java
index 7c5635f..0c74dbe 100644 (file)
@@ -52,14 +52,13 @@ public class Message extends MIME.Part {
         Stream stream = in.getStream();
         while(true) {
             String s = stream.readln();
-            if (s == null) break;
-            if (to != null && s.toLowerCase().startsWith("envelope-to:")) continue;
-            if (s.toLowerCase().startsWith("return-path:")) continue;
-            if (s.length() == 0) {
+            if (s == null || s.length() == 0) {
                 if (to != null) sb.append("Envelope-To: " + to.toString(true) + "\r\n");
                 sb.append("\r\n");
                 break;
             }
+            if (to != null && s.toLowerCase().startsWith("envelope-to:")) continue;
+            if (s.toLowerCase().startsWith("return-path:")) continue;
             sb.append(s);
             sb.append("\r\n");
         }
@@ -142,6 +141,6 @@ public class Message extends MIME.Part {
     public String toString() { throw new RuntimeException("Message.toString() called"); }
     public String summary() { return "[" + envelopeFrom + " -> " + envelopeTo + "] " + subject; }
 
-    public static class Malformed extends Exception { public Malformed(String s) { super(s); } }
+    public static class Malformed extends MailException { public Malformed(String s) { super(s); } }
 }