james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r381986 - /james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
Date Wed, 01 Mar 2006 11:10:36 GMT
Author: bago
Date: Wed Mar  1 03:10:33 2006
New Revision: 381986

URL: http://svn.apache.org/viewcvs?rev=381986&view=rev
Log:
Support for gatewayusername and gatewayPassword in the RemoteDelivery configuration (JAMES-299)

Modified:
    james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=381986&r1=381985&r2=381986&view=diff
==============================================================================
--- 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 Wed
Mar  1 03:10:33 2006
@@ -204,6 +204,8 @@
     private int connectionTimeout = 60000;  // The amount of time JavaMail will wait before
giving up on a socket connect()
     private int deliveryThreadCount = 1; // default number of delivery threads
     private Collection gatewayServer = null; // the server(s) to send all email to
+    private String authUser = null; // auth for gateway server
+    private String authPass = null; // password for gateway server
     private String bindAddress = null; // JavaMail delivery socket binds to this local address.
If null the JavaMail default will be used.
     private boolean isBindUsed = false; // true, if the bind configuration
                                         // parameter is supplied, RemoteDeliverySocketFactory
@@ -214,6 +216,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
+
     
     /**
      * Initialize the mailet
@@ -301,6 +304,8 @@
                 if (isDebug) log("Adding SMTP gateway: " + server) ;
                 gatewayServer.add(server);
             }
+            authUser = getInitParameter("gatewayusername");
+            authPass = getInitParameter("gatewayPassword");
         }
 
         ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
@@ -478,7 +483,11 @@
                     try {
                         transport = session.getTransport(outgoingMailServer);
                         try {
-                            transport.connect();
+                            if (authUser != null) {
+                                transport.connect(outgoingMailServer.getHostName(), authUser,
authPass);
+                            } else {
+                                transport.connect();
+                            }
                         } catch (MessagingException me) {
                             // Any error on connect should cause the mailet to attempt
                             // to connect to the next SMTP server associated with this
@@ -1065,6 +1074,10 @@
                       "org.apache.james.transport.mailets.RemoteDeliverySocketFactory");
             // Don't fallback to the standard socket factory on error, do throw an exception
             props.put("mail.smtp.socketFactory.fallback", "false");
+        }
+        
+        if (authUser != null) {
+            props.put("mail.smtp.auth","true");
         }
 
         Session session = Session.getInstance(props, null);



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


Mime
View raw message