fixed JS bug in ibex.mail.forward()
[org.ibex.mail.git] / src / org / ibex / mail / target / Script.java
index f3e8adf..3a87567 100644 (file)
@@ -32,7 +32,7 @@ public class Script extends Target {
     private String filePath = null;
     public Script(String filePath) throws JSExn, IOException {
         this.filePath = filePath;
-        js = JSU.cloneWithNewGlobalScope(JSU.fromReader(filePath, 0, new InputStreamReader(new FileInputStream(filePath))),
+        js = JSU.cloneWithNewGlobalScope(JSU.fromReader(filePath, 1, new InputStreamReader(new FileInputStream(filePath))),
                                          new ScriptScope()); }
 
     private class ScriptScope extends JS.Immutable {
@@ -177,8 +177,8 @@ public class Script extends Target {
                         public void accept(Message m) throws MailException {
                             try {
                                 Message m2 = Message.newMessage(new org.ibex.io.Stream(m.toString()),
-                                                         m.envelopeFrom,
-                                                         new Address(a.toString()));
+                                                                m.envelopeFrom,
+                                                                new Address(JSU.toString(a)));
                                 org.ibex.mail.protocol.SMTP.Outgoing.accept(m2);
                             } catch (Exception e) {
                                 throw new MailException(e.toString());