String body = buf.toString();
Message m = null;
for(int i=0; i<to.size(); i++) {
- m = new Message(from, (Address)to.elementAt(i), new Stream(body));
- if (!m.envelopeTo.isLocal()) Outgoing.accept(m);
+ m = new Message(new Stream(body), new Message.Envelope(from, (Address)to.elementAt(i), new Date()));
+ if (!m.envelope.to.isLocal()) Outgoing.accept(m);
else Target.root.accept(m);
}
if (m != null) Log.info(SMTP.class, "accepted message: " + m.summary());
}
public static boolean attempt(Message m) throws IOException {
- InetAddress[] mx = getMailExchangerIPs(m.envelopeTo.host);
+ InetAddress[] mx = getMailExchangerIPs(m.envelope.to.host);
if (mx.length == 0) {
- Log.warn(SMTP.Outgoing.class, "could not resolve " + m.envelopeTo.host + "; bouncing it\n" + m.summary());
- accept(m.bounce("could not resolve " + m.envelopeTo.host));
+ Log.warn(SMTP.Outgoing.class, "could not resolve " + m.envelope.to.host + "; bouncing it\n" + m.summary());
+ accept(m.bounce("could not resolve " + m.envelope.to.host));
return true;
}
- if (new Date().getTime() - m.arrival.getTime() > 1000 * 60 * 60 * 24 * 5) {
+ if (new Date().getTime() - m.envelope.arrival.getTime() > 1000 * 60 * 60 * 24 * 5) {
Log.warn(SMTP.Outgoing.class, "could not send message after 5 days; bouncing it\n" + m.summary());
accept(m.bounce("could not send for 5 days"));
return true;
Log.info(SMTP.Outgoing.class, "connected");
check(conn.readln(), conn); // banner
conn.println("HELO " + conn.vhost); check(conn.readln(), conn);
- 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("MAIL FROM:<" + m.envelope.from.user + "@" + m.envelope.from.host+">"); check(conn.readln(), conn);
+ conn.println("RCPT TO:<" + m.envelope.to.user + "@" + m.envelope.to.host+">"); check(conn.readln(), conn);
conn.println("DATA"); check(conn.readln(), conn);
conn.println(m.toString());
conn.println(".");