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 2006/12/18 07:48:13 UTC

svn commit: r488136 - in /james/server/trunk/src: conf/james-config.xml java/org/apache/james/transport/mailets/RemoteDelivery.java

Author: norman
Date: Sun Dec 17 22:48:12 2006
New Revision: 488136

URL: http://svn.apache.org/viewvc?view=rev&rev=488136
Log:
Revert fix i commited for heloname usage in RemoteDelivery. This fix is not needed cause its possible to set the heloname with <mail.smtp.localhost>some.host.name</mail.smtp.localhost> (Thx Stefano for reporting). See JAMES-735

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

Modified: james/server/trunk/src/conf/james-config.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/src/conf/james-config.xml?view=diff&rev=488136&r1=488135&r2=488136
==============================================================================
--- james/server/trunk/src/conf/james-config.xml (original)
+++ james/server/trunk/src/conf/james-config.xml Sun Dec 17 22:48:12 2006
@@ -697,12 +697,6 @@
             <gateway> otherserver.mydomain.com </gateway>
             <gatewayPort>25</gatewayPort>
             -->
-            
-            <!-- The name which will be used as HELO. If not set the heloName configured in James block -->
-            <!-- will be used. -->
-            <!--
-            <helloName> myMailServer </helloName> 
-            -->
          </mailet>
 
       </processor>

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewvc/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?view=diff&rev=488136&r1=488135&r2=488136
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java Sun Dec 17 22:48:12 2006
@@ -228,8 +228,6 @@
     // The retry count dnsProblemErrors
     private int dnsProblemRetry = 0;
     
-    private String helloName = null;
-    
     /**
      * Initialize the mailet
      */
@@ -387,9 +385,6 @@
         if (dnsRetry != null && !dnsRetry.equals("")) {
             dnsProblemRetry = Integer.parseInt(dnsRetry); 
         }
-        
-        helloName = getInitParameter("helloName");
-        
     }
     
     /**
@@ -1115,43 +1110,26 @@
      * 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
+         * started before the SMTP Server, which establishes the value.
+         * Since there is no contractual guarantee that there will be a
+         * HELLO_NAME value, we can't just wait for it.  As a temporary
+         * measure, I'm inserting this philosophically unsatisfactory
+         * fix.
+         */
+        long stop = System.currentTimeMillis() + 60000;
+        while ((getMailetContext().getAttribute(Constants.HELLO_NAME) == null)
+               && stop > System.currentTimeMillis()) {
+            try {
+                Thread.sleep(1000);
+            } catch (Exception ignored) {} // wait for James to finish initializing
+        }
+
         //Checks the pool and delivers a mail message
         Properties props = new Properties();
-        
-        if (helloName == null) {
-            /* 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
-             * started before the SMTP Server, which establishes the value.
-             * Since there is no contractual guarantee that there will be a
-             * HELLO_NAME value, we can't just wait for it.  As a temporary
-             * measure, I'm inserting this philosophically unsatisfactory
-             * fix.
-             * 
-             * When we drop backward compatibility we can remove the waiting, cause if the heloName is configured
-             * in the james block it will be set in the attributes before the mailets get init
-             */
-            long stop = System.currentTimeMillis() + 60000;
-            while ((getMailetContext().getAttribute(Constants.HELLO_NAME) == null)
-                   && stop > System.currentTimeMillis()) {
-                try {
-                    Thread.sleep(1000);
-                } catch (Exception ignored) {} // wait for James to finish initializing
-            }
-            
-            String defaultDomain = (String) getMailetContext().getAttribute(Constants.HELLO_NAME);
-            if (defaultDomain != null) {
-                props.put("mail.smtp.localhost", defaultDomain);
-            } else {
-                defaultDomain = (String) getMailetContext().getAttribute(Constants.DEFAULT_DOMAIN);
-                if (defaultDomain != null) {
-                    props.put("mail.smtp.localhost", defaultDomain);
-                }
-            }
-        } else {
-            props.put("mail.smtp.localhost", helloName);
-        }
-        
         //Not needed for production environment
         props.put("mail.debug", "false");
         // Reactivated: javamail 1.3.2 should no more have problems with "250 OK"
@@ -1167,6 +1145,17 @@
 
         props.put("mail.smtp.connectiontimeout", connectionTimeout + "");
         props.put("mail.smtp.sendpartial",String.valueOf(sendPartial));
+
+        //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 {
+            String defaultDomain = (String) getMailetContext().getAttribute(Constants.DEFAULT_DOMAIN);
+            if (defaultDomain != null) {
+                props.put("mail.smtp.localhost", defaultDomain);
+            }
+        }
 
         if (isBindUsed) {
             // undocumented JavaMail 1.2 feature, smtp transport will use



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