Index: /home/maurer/stuff/workspace/james-dev/src/java/org/apache/james/smtpserver/EhloCmdHandler.java
===================================================================
--- /home/maurer/stuff/workspace/james-dev/src/java/org/apache/james/smtpserver/EhloCmdHandler.java	(revision 392343)
+++ /home/maurer/stuff/workspace/james-dev/src/java/org/apache/james/smtpserver/EhloCmdHandler.java	(working copy)
@@ -41,6 +41,8 @@
      */
     private boolean checkValidEhlo = false;
     
+    private boolean ignoreRelay = true;
+    
     /**
      * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
      */
@@ -49,6 +51,11 @@
         if(configuration != null) {
            checkValidEhlo = configuration.getValueAsBoolean();
         }
+        
+        Configuration configRelay = handlerConfiguration.getChild("ignoreRelayClients",false);
+        if(configRelay != null) {
+            ignoreRelay = configRelay.getValueAsBoolean();
+        }
     }
 
     /*
@@ -75,15 +82,22 @@
         
         // check for helo if its set in config
         if (checkValidEhlo == true) {
+            
+            /**
+             * don't check if the ip address is allowed to relay. Only check if it is set in the config. ed.
+             */
+            if (session.isRelayingAllowed() == false || ignoreRelay == false) {
+
              
-            // try to resolv the provided helo. If it can not resolved do not accept it.
-            try {
-                org.apache.james.dnsserver.DNSServer.getByName(argument);
-            } catch (UnknownHostException e) {
-                badEhlo = true;
-                responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+" Provided EHLO " + argument + " can not resolved";
-                session.writeResponse(responseString);
-                getLogger().info(responseString);
+                // try to resolv the provided helo. If it can not resolved do not accept it.
+                try {
+                    org.apache.james.dnsserver.DNSServer.getByName(argument);
+                } catch (UnknownHostException e) {
+                    badEhlo = true;
+                    responseString = "501 "+DSNStatus.getStatus(DSNStatus.PERMANENT,DSNStatus.DELIVERY_INVALID_ARG)+" Provided EHLO " + argument + " can not resolved";
+                    session.writeResponse(responseString);
+                    getLogger().info(responseString);
+                }
             }
         }
         
