You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2007/01/08 14:15:04 UTC

svn commit: r494056 - in /james/server/branches/v2.3/src: conf/james-config.xml java/org/apache/james/transport/mailets/RemoteDelivery.java

Author: norman
Date: Mon Jan  8 05:15:03 2007
New Revision: 494056

URL: http://svn.apache.org/viewvc?view=rev&rev=494056
Log:
Merge fix for JAMES-735

Modified:
    james/server/branches/v2.3/src/conf/james-config.xml
    james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java

Modified: james/server/branches/v2.3/src/conf/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/src/conf/james-config.xml?view=diff&rev=494056&r1=494055&r2=494056
==============================================================================
--- james/server/branches/v2.3/src/conf/james-config.xml (original)
+++ james/server/branches/v2.3/src/conf/james-config.xml Mon Jan  8 05:15:03 2007
@@ -590,6 +590,11 @@
             <gateway> otherserver.mydomain.com </gateway>
             <gatewayPort>25</gatewayPort>
             -->
+            
+            <!-- Set the HELO/EHLO name to use when connectiong to remote SMTP-Server -->
+            <!--
+            <mail.smtp.localhost>myMailServer</mail.smtp.localhost>
+            -->
          </mailet>
 
       </processor>

Modified: james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewvc/james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?view=diff&rev=494056&r1=494055&r2=494056
==============================================================================
--- james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
+++ james/server/branches/v2.3/src/java/org/apache/james/transport/mailets/RemoteDelivery.java Mon Jan  8 05:15:03 2007
@@ -223,7 +223,7 @@
 
     private Perl5Matcher delayTimeMatcher; //matcher use at init time to parse delaytime parameters
     private MultipleDelayFilter delayFilter = new MultipleDelayFilter ();//used by accept to selcet the next mail ready for processing
-
+    private Properties defprops = new Properties(); // default properties for the javamail Session
     
     /**
      * Initialize the mailet
@@ -359,6 +359,14 @@
         } catch (UnknownHostException e) {
             log("Invalid bind setting (" + bindAddress + "): " + e.toString());
         }
+        
+        Iterator i = getInitParameterNames();
+        while (i.hasNext()) {
+            String name = (String) i.next();
+            if (name.startsWith("mail.")) {
+                defprops.put(name,getInitParameter(name));
+            }
+        }
     }
 
     /*
@@ -1035,7 +1043,6 @@
      * there are any
      */
     public void run() {
-
         /* TODO: CHANGE ME!!! The problem is that we need to wait for James to
          * finish initializing.  We expect the HELLO_NAME to be put into
          * the MailetContext, but in the current configuration we get
@@ -1047,9 +1054,10 @@
          */
         long stop = System.currentTimeMillis() + 60000;
         while ((getMailetContext().getAttribute(Constants.HELLO_NAME) == null)
-               && stop > System.currentTimeMillis()) {
+            && stop > System.currentTimeMillis()) {
+            
             try {
-                Thread.sleep(1000);
+               Thread.sleep(1000);
             } catch (Exception ignored) {} // wait for James to finish initializing
         }
 
@@ -1073,9 +1081,8 @@
 
         //Set the hostname we'll use as this server
         if (getMailetContext().getAttribute(Constants.HELLO_NAME) != null) {
-            props.put("mail.smtp.localhost", getMailetContext().getAttribute(Constants.HELLO_NAME));
-        }
-        else {
+           props.put("mail.smtp.localhost", getMailetContext().getAttribute(Constants.HELLO_NAME));
+        } else {
             String defaultDomain = (String) getMailetContext().getAttribute(Constants.DEFAULT_DOMAIN);
             if (defaultDomain != null) {
                 props.put("mail.smtp.localhost", defaultDomain);
@@ -1095,6 +1102,8 @@
             props.put("mail.smtp.auth","true");
         }
 
+        props.putAll(defprops);
+        
         Session session = Session.getInstance(props, null);
         try {
             while (!Thread.interrupted() && !destroyed) {



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org