noel        2003/02/14 20:29:24

  Modified:    src/java/org/apache/james/transport/mailets
                        RemoteDelivery.java
               src/conf james-config.xml
  Log:
  Jason Webb's patches to provide more control over JavaMail delivery
  
  Revision  Changes    Path
  1.43      +20 -5     
jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
  
  Index: RemoteDelivery.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- RemoteDelivery.java       6 Feb 2003 15:55:32 -0000       1.42
  +++ RemoteDelivery.java       15 Feb 2003 04:29:23 -0000      1.43
  @@ -74,6 +74,8 @@
       private long delayTime = 21600000; // default is 6*60*60*1000 millis (6 hours)
       private int maxRetries = 5; // default number of retries
       private long smtpTimeout = 600000;  //default number of ms to timeout on smtp 
delivery
  +    private boolean sendPartial = false; // If false then ANY address errors will 
cause the transmission to fail
  +    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 String gatewayServer = null; // the server to send all email to
       private String gatewayPort = null;  //the port of the gateway server to send 
all email to
  @@ -107,6 +109,16 @@
           } catch (Exception e) {
               log("Invalid timeout setting: " + getInitParameter("timeout"));
           }
  +
  +        try {
  +            if (getInitParameter("connectiontimeout") != null) {
  +                connectionTimeout = 
Integer.parseInt(getInitParameter("connectiontimeout"));
  +            }
  +        } catch (Exception e) {
  +            log("Invalid timeout setting: " + getInitParameter("timeout"));
  +        }
  +        sendPartial = (getInitParameter("sendpartial") == null) ? false : new 
Boolean(getInitParameter("sendpartial")).booleanValue();
  +
           gatewayServer = getInitParameter("gateway");
           gatewayPort = getInitParameter("gatewayPort");
   
  @@ -137,8 +149,8 @@
        * throw an exception.
        *
        * Creation date: (2/24/00 11:25:00 PM)
  -     * @param Mail org.apache.mailet.Mail
  -     * @param Session javax.mail.Session
  +     * @param mail org.apache.mailet.Mail
  +     * @param session javax.mail.Session
        * @return boolean Whether the delivery was successful and the message can be 
deleted
        */
       private boolean deliver(Mail mail, Session session) {
  @@ -320,7 +332,7 @@
        * Insert the method's description here.
        * Creation date: (2/25/00 1:14:18 AM)
        * @param mail org.apache.mailet.MailImpl
  -     * @param exception java.lang.Exception
  +     * @param ex javax.mail.MessagingException
        * @param boolean permanent
        * @return boolean Whether the message failed fully and can be deleted
        */
  @@ -441,7 +453,6 @@
        * messagecontainer ... that will handle storing it in the outgoing queue if 
needed.
        *
        * @param mail org.apache.mailet.Mail
  -     * @return org.apache.mailet.MessageContainer
        */
       public void service(Mail mail) throws AddressException {
   
  @@ -549,6 +560,10 @@
           props.put("mail.smtp.ehlo", "false");
           //Sets timeout on going connections
           props.put("mail.smtp.timeout", smtpTimeout + "");
  +
  +        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(MailetContextConstants.HELLO_NAME) != 
null) {
               props.put("mail.smtp.localhost", (String) 
getMailetContext().getAttribute(MailetContextConstants.HELLO_NAME));
  
  
  
  1.46      +4 -1      jakarta-james/src/conf/james-config.xml
  
  Index: james-config.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/conf/james-config.xml,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- james-config.xml  5 Feb 2003 04:30:03 -0000       1.45
  +++ james-config.xml  15 Feb 2003 04:29:24 -0000      1.46
  @@ -278,6 +278,9 @@
               <!-- The number of threads that should be trying to deliver outgoing 
messages -->
               <deliveryThreads> 1 </deliveryThreads>
   
  +            <!-- If false the message will not be sent to given server if any 
recipients fail -->
  +            <sendpartial>false</sendpartial>
  +
               <!-- A single mail server to deliver all outgoing messages. -->
               <!-- This is useful if this server is a backup or failover machine, -->
               <!-- or if you want all messages to be routed through a particular mail 
server, -->
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to