From 8f51703db4fd6fa1ddfa6e897f2a762bfb3e3d63 Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 7 Jul 2004 08:55:47 +0000 Subject: [PATCH] make javascript ibex.mail.send() synchronous darcs-hash:20040707085547-5007d-eeac22f3d84c701d686f44602d7577c99caed0e2.gz --- src/org/ibex/mail/protocol/SMTP.java | 2 +- src/org/ibex/mail/target/Script.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/ibex/mail/protocol/SMTP.java b/src/org/ibex/mail/protocol/SMTP.java index 4fea25e..f7a91e0 100644 --- a/src/org/ibex/mail/protocol/SMTP.java +++ b/src/org/ibex/mail/protocol/SMTP.java @@ -100,7 +100,7 @@ public class SMTP { } } - private static boolean attempt(Message m) throws IOException { + public static boolean attempt(Message m) throws IOException { 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()); diff --git a/src/org/ibex/mail/target/Script.java b/src/org/ibex/mail/target/Script.java index 89ff260..f5e7840 100644 --- a/src/org/ibex/mail/target/Script.java +++ b/src/org/ibex/mail/target/Script.java @@ -125,7 +125,9 @@ public class Script extends Target { else headers.append(key + ": " + val + "\r\n"); } Message message = new Message(null, null, new org.ibex.io.Stream(headers.toString() + "\r\n" + body)); - org.ibex.mail.protocol.SMTP.Outgoing.accept(message); + //org.ibex.mail.protocol.SMTP.Outgoing.accept(message); + boolean ok = org.ibex.mail.protocol.SMTP.Outgoing.attempt(message); + if (!ok) throw new JSExn("SMTP server rejected message"); return T; } if (name.equals("mail.forward")) { return new Target() { -- 1.7.10.4