make javascript ibex.mail.send() synchronous
authoradam <adam@megacz.com>
Wed, 7 Jul 2004 08:55:47 +0000 (08:55 +0000)
committeradam <adam@megacz.com>
Wed, 7 Jul 2004 08:55:47 +0000 (08:55 +0000)
darcs-hash:20040707085547-5007d-eeac22f3d84c701d686f44602d7577c99caed0e2.gz

src/org/ibex/mail/protocol/SMTP.java
src/org/ibex/mail/target/Script.java

index 4fea25e..f7a91e0 100644 (file)
@@ -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());
index 89ff260..f5e7840 100644 (file)
@@ -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() {