Hello,

  The Redirect mailet doesn't handle null 'sender' and 'replyto'
parameters. The patch is here.

  It seems that there is no way to keep the recipients of
the original message.
  If "to" parameter is not specified, "recipients" parameter is
used, then "To:" header will be initialized with "recipients".

  I suggest keep original "To:" header if "to" parameter is
omitted or is specified with special constant.


--
Iwasa Kazmi


Index: Redirect.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java,v
retrieving revision 1.1
diff -u -r1.1 Redirect.java
--- Redirect.java       2001/10/23 10:22:40     1.1
+++ Redirect.java       2001/12/13 14:14:29
@@ -390,20 +390,22 @@
 */
     public MailAddress getSender(){
         String sr = getInitParameter("sender");
-        MailAddress rv;
-        if(sr.compareTo("postmaster")==0){
-            rv = getMailetContext().getPostmaster();
-            return rv;
+        if(sr != null){
+            MailAddress rv;
+            if(sr.compareTo("postmaster")==0){
+                rv = getMailetContext().getPostmaster();
+                return rv;
+            }
+            if(sr.compareTo("sender")==0){
+                return null;
+            }
+            try{
+                rv = new MailAddress(sr);
+                return rv;
+            }catch(Exception e){
+                log("Parse error in getSender "+sr);
+            }
         }
-        if((sr.compareTo("sender")==0) || (sr==null)){
-            return null;
-        }
-        try{
-            rv = new MailAddress(sr);
-            return rv;
-        }catch(Exception e){
-            log("Parse error in getSender "+sr);
-        }
         return null;
     }
 /**
@@ -467,20 +469,21 @@
 */
     public MailAddress getReplyTo(){
         String sr = getInitParameter("replyto");
-
-        MailAddress rv;
-        if(sr.compareTo("postmaster")==0){
-            rv = getMailetContext().getPostmaster();
-            return rv;
-        }
-        if((sr.compareTo("sender")==0) || (sr == null)){
-            return null;
-        }
-        try{
-            rv = new MailAddress(sr);
-            return rv;
-        }catch(Exception e){
-            log("Parse error in getReplyTo "+sr);
+        if(sr != null){
+            MailAddress rv;
+            if(sr.compareTo("postmaster")==0){
+                rv = getMailetContext().getPostmaster();
+                return rv;
+            }
+            if(sr.compareTo("sender")==0){
+                return null;
+            }
+            try{
+                rv = new MailAddress(sr);
+                return rv;
+            }catch(Exception e){
+                log("Parse error in getReplyTo "+sr);
+            }
         }
         return null;
     }

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

Reply via email to