+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the Apache Public Source License 2.0 ("the License").
+// You may not use this file except in compliance with the License.
+
package org.ibex.mail.protocol;
import org.ibex.mail.*;
import org.ibex.mail.target.*;
String body = buf.toString();
Message m = null;
for(int i=0; i<to.size(); i++) {
- m = Message.newMessage(new Stream(body), from, (Address)to.elementAt(i));
+ m = Message.newMessage(new Fountain.StringFountain(body), from, (Address)to.elementAt(i));
if (!m.envelopeTo.isLocal()) Outgoing.accept(m);
else Target.root.accept(m);
}
}
public static boolean attempt(Message m) throws IOException {
+ if (m.envelopeTo == null) {
+ Log.warn(SMTP.Outgoing.class, "aieeee, null envelopeTo: " + m.summary());
+ return false;
+ }
InetAddress[] mx = getMailExchangerIPs(m.envelopeTo.host);
if (mx.length == 0) {
Log.warn(SMTP.Outgoing.class, "could not resolve " + m.envelopeTo.host + "; bouncing it\n" + m.summary());
}
private static void check(String s, Connection conn) {
- while (s.charAt(3) == '-') s = conn.readln();
+ while (s.length() > 3 && s.charAt(3) == '-') s = conn.readln();
if (s.startsWith("4")||s.startsWith("5")) throw new SMTPException(s);
}
private static boolean attempt(final Message m, final InetAddress mx) {
conn.println("MAIL FROM:<" + m.envelopeFrom.user + "@" + m.envelopeFrom.host+">"); check(conn.readln(), conn);
conn.println("RCPT TO:<" + m.envelopeTo.user + "@" + m.envelopeTo.host+">"); check(conn.readln(), conn);
conn.println("DATA"); check(conn.readln(), conn);
- Stream stream = new Stream(m.toString());
+ Stream stream = m.getStream();
boolean inheaders = true;
while(true) {
String s = stream.readln();