Index: src/java/org/apache/james/transport/mailets/Redirect.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java,v
retrieving revision 1.18.4.9
diff -u -r1.18.4.9 Redirect.java
--- src/java/org/apache/james/transport/mailets/Redirect.java	6 Jun 2003 23:55:04 -0000	1.18.4.9
+++ src/java/org/apache/james/transport/mailets/Redirect.java	8 Jun 2003 18:26:41 -0000
@@ -87,151 +87,157 @@
 
 
 /**
-*<P>A mailet providing configurable redirection services<BR>
-*This mailet can produce listserver, forward and notify behaviour, with the original
-*message intact, attached, appended or left out altogether.<BR>
-*This built in functionality is controlled by the configuration as laid out below.</P>
-*<P>The configuration parameters are:</P>
-*<TABLE width="75%" border="0" cellspacing="2" cellpadding="2">
-*<TR>
-*<TD width="20%">&lt;recipients&gt;</TD>
-*<TD width="80%">A comma delimited list of email addresses for recipients of
-*this message, it will use the &quot;to&quot; list if not specified. These
-*addresses will only appear in the To: header if no &quot;to&quot; list is
-*supplied.<BR>
-*It can include constants &quot;sender&quot;, &quot;postmaster&quot; and &quot;returnPath&quot;</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;to&gt;</TD>
-*<TD width="80%">A comma delimited list of addresses to appear in the To: header,
-*the email will only be delivered to these addresses if they are in the recipients
-*list.<BR>
-*The recipients list will be used if this is not supplied.<BR>
-*It can include constants &quot;sender&quot;, &quot;postmaster&quot;, &quot;returnPath&quot; and &quot;unaltered&quot;</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;sender&gt;</TD>
-*<TD width="80%">A single email address to appear in the From: header <BR>
-*It can include constants &quot;sender&quot; and &quot;postmaster&quot;</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;message&gt;</TD>
-*<TD width="80%">A text message to be the body of the email. Can be omitted.</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;inline&gt;</TD>
-*<TD width="80%">
-*<P>One of the following items:</P>
-*<UL>
-*<LI>unaltered &nbsp;&nbsp;&nbsp;&nbsp;The original message is the new
-* message, for forwarding/aliasing</LI>
-*<LI>heads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The
-* headers of the original message are appended to the message</LI>
-*<LI>body&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The
-* body of the original is appended to the new message</LI>
-*<LI>all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Both
-* headers and body are appended</LI>
-*<LI>none&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Neither
-* body nor headers are appended</LI>
-*</UL>
-*</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;attachment&gt;</TD>
-*<TD width="80%">
-*<P>One of the following items:</P>
-*<UL>
-*<LI>heads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The headers of the original
-* are attached as text</LI>
-*<LI>body&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The body of the original
-* is attached as text</LI>
-*<LI>all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Both
-* headers and body are attached as a single text file</LI>
-*<LI>none&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nothing is attached</LI>
-*<LI>message &nbsp;The original message is attached as type message/rfc822,
-* this means that it can, in many cases, be opened, resent, fw'd, replied
-* to etc by email client software.</LI>
-*</UL>
-*</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;passThrough&gt;</TD>
-*<TD width="80%">TRUE or FALSE, if true the original message continues in the
-*mailet processor after this mailet is finished. False causes the original
-*to be stopped.</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;attachError&gt;</TD>
-*<TD width="80%">TRUE or FALSE, if true any error message available to the
-*mailet is appended to the message body (except in the case of inline ==
-*unaltered)</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;replyto&gt;</TD>
-*<TD width="80%">A single email address to appear in the Reply-To: header, can
-*also be &quot;sender&quot; or &quot;postmaster&quot;, this header is not
-*set if this is omitted.</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;returnPath&gt;</TD>
-*<TD width="80%">A single email address to appear in the Return-Path: header, can
-*also be &quot;sender&quot; or &quot;postmaster&quot; or &quot;null&quot;; this header is not
-*set if this parameter is omitted.</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;prefix&gt;</TD>
-*<TD width="80%">An optional subject prefix prepended to the original message
-*subject, for example:<BR>
-*Undeliverable mail: </TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;isReply&gt;</TD>
-*<TD width="80%">TRUE or FALSE, if true the IN_REPLY_TO header will be set to the
-*id of the current message.</TD>
-*</TR>
-*<TR>
-*<TD width="20%">&lt;static&gt;</TD>
-*<TD width="80%">
-*<P>TRUE or FALSE.  If this is TRUE it tells the mailet that it can
-*reuse all the initial parameters (to, from, etc) without re-calculating
-*their values.  This will boost performance where a redirect task
-*doesn't contain any dynamic values.  If this is FALSE, it tells the
-*mailet to recalculate the values for each e-mail processed.</P>
-*<P>This defaults to false.<BR>
-*</TD>
-*</TR>
-*</TABLE>
-*
-*<P>Example:</P>
-*<P> &lt;mailet match=&quot;RecipientIs=test@localhost&quot; class=&quot;Redirect&quot;&gt;<BR>
-*&lt;recipients&gt;x@localhost, y@localhost, z@localhost&lt;/recipients&gt;<BR>
-*&lt;to&gt;list@localhost&lt;/to&gt;<BR>
-*&lt;sender&gt;owner@localhost&lt;/sender&gt;<BR>
-*&lt;message&gt;sent on from James&lt;/message&gt;<BR>
-*&lt;inline&gt;unaltered&lt;/inline&gt;<BR>
-*&lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
-*&lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
-*&lt;prefix xml:space="preserve"&gt;[test mailing] &lt;/prefix&gt;<BR>
-*&lt;!-- note the xml:space="preserve" to preserve whitespace --&gt;<BR>
-*&lt;static&gt;TRUE&lt;/static&gt;<BR>
-*&lt;/mailet&gt;<BR>
-*</P>
-*<P>and:</P>
-*<P> &lt;mailet match=&quot;All&quot; class=&quot;Redirect&quot;&gt;<BR>
-*&lt;recipients&gt;x@localhost&lt;/recipients&gt;<BR>
-*&lt;sender&gt;postmaster&lt;/sender&gt;<BR>
-*&lt;message xml:space="preserve"&gt;Message marked as spam:<BR>
-*&lt;/message&gt;<BR>
-*&lt;inline&gt;heads&lt;/inline&gt;<BR>
-*&lt;attachment&gt;message&lt;/attachment&gt;<BR>
-*&lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
-*&lt;attachError&gt;TRUE&lt;/attachError&gt;<BR>
-*&lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
-*&lt;prefix&gt;[spam notification]&lt;/prefix&gt;<BR>
-*&lt;static&gt;TRUE&lt;/static&gt;<BR>
-*&lt;/mailet&gt;</P>
+ * <P>A mailet providing configurable redirection services<BR>
+ * This mailet can produce listserver, forward and notify behaviour, with the original
+ * message intact, attached, appended or left out altogether.<BR>
+ * This built in functionality is controlled by the configuration as laid out below.</P>
+ * <P>The configuration parameters are:</P>
+ * <TABLE width="75%" border="0" cellspacing="2" cellpadding="2">
+ * <TR>
+ * <TD width="20%">&lt;recipients&gt;</TD>
+ * <TD width="80%">A comma delimited list of email addresses for recipients of
+ * this message, it will use the &quot;to&quot; list if not specified. These
+ * addresses will only appear in the To: header if no &quot;to&quot; list is
+ * supplied.<BR>
+ * It can include constants &quot;sender&quot;, &quot;postmaster&quot; and &quot;returnPath&quot;</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;to&gt;</TD>
+ * <TD width="80%">A comma delimited list of addresses to appear in the To: header,
+ * the email will only be delivered to these addresses if they are in the recipients
+ * list.<BR>
+ * The recipients list will be used if this is not supplied.<BR>
+ * It can include constants &quot;sender&quot;, &quot;postmaster&quot;, &quot;returnPath&quot; and &quot;unaltered&quot;</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;sender&gt;</TD>
+ * <TD width="80%">A single email address to appear in the From: header <BR>
+ * It can include constants &quot;sender&quot; and &quot;postmaster&quot;</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;message&gt;</TD>
+ * <TD width="80%">A text message to be the body of the email. Can be omitted.</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;inline&gt;</TD>
+ * <TD width="80%">
+ * <P>One of the following items:</P>
+ * <UL>
+ * <LI>unaltered &nbsp;&nbsp;&nbsp;&nbsp;The original message is the new
+ * message, for forwarding/aliasing</LI>
+ * <LI>heads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The
+ * headers of the original message are appended to the message</LI>
+ * <LI>body&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The
+ * body of the original is appended to the new message</LI>
+ * <LI>all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Both
+ * headers and body are appended</LI>
+ * <LI>none&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Neither
+ * body nor headers are appended</LI>
+ * </UL>
+ * </TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;attachment&gt;</TD>
+ * <TD width="80%">
+ * <P>One of the following items:</P>
+ * <UL>
+ * <LI>heads&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The headers of the original
+ * are attached as text</LI>
+ * <LI>body&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The body of the original
+ * is attached as text</LI>
+ * <LI>all&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Both
+ * headers and body are attached as a single text file</LI>
+ * <LI>none&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Nothing is attached</LI>
+ * <LI>message &nbsp;The original message is attached as type message/rfc822,
+ * this means that it can, in many cases, be opened, resent, fw'd, replied
+ * to etc by email client software.</LI>
+ * </UL>
+ * </TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;passThrough&gt;</TD>
+ * <TD width="80%">true or false, if true the original message continues in the
+ * mailet processor after this mailet is finished. False causes the original
+ * to be stopped. The default is false.</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;fakeDomainCheck&gt;</TD>
+ * <TD width="80%">TRUE or FALSE, if true will check if the sender domain is valid.
+ * The default is true.</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;attachError&gt;</TD>
+ * <TD width="80%">TRUE or FALSE, if true any error message available to the
+ * mailet is appended to the message body (except in the case of inline ==
+ * unaltered)</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;replyto&gt;</TD>
+ * <TD width="80%">A single email address to appear in the Reply-To: header, can
+ * also be &quot;sender&quot; or &quot;postmaster&quot;, this header is not
+ * set if this is omitted.</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;returnPath&gt;</TD>
+ * <TD width="80%">A single email address to appear in the Return-Path: header, can
+ * also be &quot;sender&quot; or &quot;postmaster&quot; or &quot;null&quot;; this header is not
+ * set if this parameter is omitted.</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;prefix&gt;</TD>
+ * <TD width="80%">An optional subject prefix prepended to the original message
+ * subject, for example:<BR>
+ * Undeliverable mail: </TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;isReply&gt;</TD>
+ * <TD width="80%">TRUE or FALSE, if true the IN_REPLY_TO header will be set to the
+ * id of the current message.</TD>
+ * </TR>
+ * <TR>
+ * <TD width="20%">&lt;static&gt;</TD>
+ * <TD width="80%">
+ * <P>TRUE or FALSE.  If this is TRUE it tells the mailet that it can
+ * reuse all the initial parameters (to, from, etc) without re-calculating
+ * their values.  This will boost performance where a redirect task
+ * doesn't contain any dynamic values.  If this is FALSE, it tells the
+ * mailet to recalculate the values for each e-mail processed.</P>
+ * <P>This defaults to false.<BR>
+ * </TD>
+ * </TR>
+ * </TABLE>
  *
+ * <P>Example:</P>
+ * <P> &lt;mailet match=&quot;RecipientIs=test@localhost&quot; class=&quot;Redirect&quot;&gt;<BR>
+ * &lt;recipients&gt;x@localhost, y@localhost, z@localhost&lt;/recipients&gt;<BR>
+ * &lt;to&gt;list@localhost&lt;/to&gt;<BR>
+ * &lt;sender&gt;owner@localhost&lt;/sender&gt;<BR>
+ * &lt;message&gt;sent on from James&lt;/message&gt;<BR>
+ * &lt;inline&gt;unaltered&lt;/inline&gt;<BR>
+ * &lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
+ * &lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
+ * &lt;prefix xml:space="preserve"&gt;[test mailing] &lt;/prefix&gt;<BR>
+ * &lt;!-- note the xml:space="preserve" to preserve whitespace --&gt;<BR>
+ * &lt;static&gt;TRUE&lt;/static&gt;<BR>
+ * &lt;/mailet&gt;<BR>
+ * </P>
+ * <P>and:</P>
+ * <P> &lt;mailet match=&quot;All&quot; class=&quot;Redirect&quot;&gt;<BR>
+ * &lt;recipients&gt;x@localhost&lt;/recipients&gt;<BR>
+ * &lt;sender&gt;postmaster&lt;/sender&gt;<BR>
+ * &lt;message xml:space="preserve"&gt;Message marked as spam:<BR>
+ * &lt;/message&gt;<BR>
+ * &lt;inline&gt;heads&lt;/inline&gt;<BR>
+ * &lt;attachment&gt;message&lt;/attachment&gt;<BR>
+ * &lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
+ * &lt;attachError&gt;TRUE&lt;/attachError&gt;<BR>
+ * &lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
+ * &lt;prefix&gt;[spam notification]&lt;/prefix&gt;<BR>
+ * &lt;static&gt;TRUE&lt;/static&gt;<BR>
+ * &lt;/mailet&gt;</P>
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
  */
 
 public class Redirect extends AbstractRedirect {
Index: src/java/org/apache/james/transport/mailets/AbstractNotify.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/AbstractNotify.java,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 AbstractNotify.java
--- src/java/org/apache/james/transport/mailets/AbstractNotify.java	6 Jun 2003 23:55:04 -0000	1.1.2.3
+++ src/java/org/apache/james/transport/mailets/AbstractNotify.java	8 Jun 2003 18:26:41 -0000
@@ -96,7 +96,7 @@
  * is set to true, such error message will be attached to the notification message.</LI>
  * <LI>The notified messages are attached in their entirety (headers and
  * content) and the resulting MIME part type is "message/rfc822".</LI>
- * <LI>passThrough is <B>true</B>.</LI>
+ * <LI>Supports by default the <CODE>passThrough</CODE> init parameter (true if missing).</LI>
  * </UL>
  *
  * <P>Sample configuration common to all notification mailet subclasses:</P>
@@ -105,9 +105,19 @@
  *   &lt;sendingAddress&gt;<I>an address or postmaster</I>&lt;/sendingAddress&gt;
  *   &lt;attachStackTrace&gt;<I>true or false, default=false</I>&lt;/attachStackTrace&gt;
  *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
+ *   &lt;prefix&gt;<I>optional subject prefix prepended to the original message</I>&lt;/prefix&gt;
+ *   &lt;inline&gt;<I>see {@link Redirect}, default=none</I>&lt;/inline&gt;
+ *   &lt;attachment&gt;<I>see {@link Redirect}, default=message</I>&lt;/attachment&gt;
+ *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
+ * <I>message</I> and <I>attachError</I> can be used instead of
+ * <I>notice and </I> and <I>attachStackTrace</I>.
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
+ * @since 2.2.0
  */
 public abstract class AbstractNotify extends AbstractRedirect {
 
@@ -116,32 +126,49 @@
     /* ******************************************************************** */
 
     /**
-     * @return true, as all notifications should
+     * @return the <CODE>passThrough</CODE> init parameter, or true if missing
      */
     protected boolean getPassThrough() throws MessagingException {
-        return true;
+        if(getInitParameter("passThrough") == null) {
+            return true;
+        } else {
+            return new Boolean(getInitParameter("passThrough")).booleanValue();
+        }
     }
 
     /**
-     * @return <CODE>NONE</CODE>
+     * @return the <CODE>inline</CODE> init parameter, or <CODE>NONE</CODE> if missing
      */
-    protected int getInLineType() {
-        return NONE;
+    protected int getInLineType() throws MessagingException {
+        if(getInitParameter("inline") == null) {
+            return NONE;
+        } else {
+            return getTypeCode(getInitParameter("inline"));
+        }
     }
 
     /**
-     * @return <CODE>MESSAGE</CODE>
+     * @return the <CODE>attachment</CODE> init parameter, or <CODE>MESSAGE</CODE> if missing
      */
-    protected int getAttachmentType() {
-        return MESSAGE;
+    protected int getAttachmentType() throws MessagingException {
+        if(getInitParameter("attachment") == null) {
+            return MESSAGE;
+        } else {
+            return getTypeCode(getInitParameter("attachment"));
+        }
     }
 
     /**
-     * @return the <CODE>notice</CODE> init parameter
+     * @return the <CODE>notice</CODE> init parameter, or the <CODE>message</CODE> init parameter if missing,
+     * or a default string if both are missing
      */
     protected String getMessage() {
         if(getInitParameter("notice") == null) {
-            return "We were unable to deliver the attached message because of an error in the mail server.";
+            if(getInitParameter("message") == null) {
+                return "We were unable to deliver the attached message because of an error in the mail server.";
+            } else {
+                return getInitParameter("message");
+            }
         } else {
             return getInitParameter("notice");
         }
@@ -225,14 +252,32 @@
     }
 
     /**
-     * @return the <CODE>attachStackTrace</CODE> init parameter
+     * @return the <CODE>prefix</CODE> init parameter or an empty string if missing
+     */
+    protected String getSubjectPrefix() throws MessagingException {
+        if(getInitParameter("prefix") == null) {
+            return "";
+        } else {
+            return getInitParameter("prefix");
+        }
+    }
+
+    /**
+     * @return the <CODE>attachStackTrace</CODE> init parameter, 
+     * or the <CODE>attachError</CODE> init parameter if missing,
+     * or false if missing 
      */
     protected boolean attachError() {
         boolean attachStackTrace = false;
         try {
             attachStackTrace = new Boolean(getInitParameter("attachStackTrace")).booleanValue();
         } catch (Exception e) {
-            // Ignore exception, default to false
+            // try with attachError
+            try {
+                attachStackTrace = new Boolean(getInitParameter("attachError")).booleanValue();
+            } catch (Exception e2) {
+                // Ignore exception, default to false
+            }
         }
         return attachStackTrace;
     }
Index: src/java/org/apache/james/transport/mailets/AbstractRedirect.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/AbstractRedirect.java,v
retrieving revision 1.1.2.6
diff -u -r1.1.2.6 AbstractRedirect.java
--- src/java/org/apache/james/transport/mailets/AbstractRedirect.java	6 Jun 2003 23:55:04 -0000	1.1.2.6
+++ src/java/org/apache/james/transport/mailets/AbstractRedirect.java	8 Jun 2003 18:26:42 -0000
@@ -107,6 +107,7 @@
  * <LI>getTo(), a list of people to whom the mail is *apparently* sent</LI>
  * <LI>isReply(), should this mailet set the IN_REPLY_TO header to the id of the current message</LI>
  * <LI>getPassThrough(), should this mailet allow the original message to continue processing or GHOST it.</LI>
+ * <LI>getFakeDomainCheck(), should this mailet check if the sender domain address is valid.</LI>
  * <LI>isStatic(), should this mailet run the get methods for every mail, or just once.</LI>
  * </UL>
  * <P>For each of the methods above (generically called "getX()" methods in this class
@@ -161,6 +162,9 @@
  * <P>Supports by default the <CODE>passThrough</CODE> init parameter (false if missing).
  * Subclasses can override this behaviour overriding {@link #getPassThrough()}.</P>
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
+ * @since 2.2.0
  */
 
 public abstract class AbstractRedirect extends GenericMailet {
@@ -229,6 +233,7 @@
     protected static final int MESSAGE          = 5;
 
     private boolean passThrough = false;
+    private boolean fakeDomainCheck = true;
     private int attachmentType = NONE;
     private int inLineType = BODY;
     private String messageText;
@@ -294,6 +299,33 @@
     }
 
     /**
+     * Gets the <CODE>fakeDomainCheck</CODE> property.
+     * Return true to check if the sender domain is valid.
+     * Is a "getX()" method.
+     *
+     * @return the <CODE>fakeDomainCheck</CODE> init parameter, or true if missing
+     */
+    protected boolean getFakeDomainCheck() throws MessagingException {
+        if(getInitParameter("fakeDomainCheck") == null) {
+            return true;
+        } else {
+            return new Boolean(getInitParameter("fakeDomainCheck")).booleanValue();
+        }
+    }
+
+    /**
+     * Gets the <CODE>fakeDomainCheck</CODE> property,
+     * built dynamically using the original Mail object.
+     * Is a "getX(Mail)" method.
+     *
+     * @return {@link #getFakeDomainCheck()}
+     */
+    protected boolean getFakeDomainCheck(Mail originalMail) throws MessagingException {
+        boolean fakeDomainCheck = (isStatic()) ? this.fakeDomainCheck : getFakeDomainCheck();
+        return fakeDomainCheck;
+    }
+
+    /**
      * Gets the <CODE>inline</CODE> property.
      * May return one of the following values to indicate how to append the original message
      * to build the new message:
@@ -736,6 +768,7 @@
 
         if(isStatic()) {
             passThrough     = getPassThrough();
+            fakeDomainCheck = getFakeDomainCheck();
             attachmentType  = getAttachmentType();
             inLineType      = getInLineType();
             messageText     = getMessage();
@@ -752,6 +785,7 @@
                     new StringBuffer(1024)
                             .append("static")
                             .append(", passThrough=").append(passThrough)
+                            .append(", fakeDomainCheck=").append(fakeDomainCheck)
                             .append(", sender=").append(sender)
                             .append(", replyTo=").append(replyTo)
                             .append(", returnPath=").append(returnPath)
@@ -1254,8 +1288,11 @@
      * Although this can be viewed as a configuration error, the
      * consequences of such a mis-configuration are severe enough
      * to warrant protecting against the infinite loop.</P>
+     * <P>This check can be skipped if {@link #getFakeDomainCheck(Mail)} returns true.</P> 
      */
-    protected final boolean senderDomainIsValid(Mail mail) {
-        return mail.getSender() == null || getMailetContext().getMailServers(mail.getSender().getHost()).size() != 0;
+    protected final boolean senderDomainIsValid(Mail mail) throws MessagingException {
+        if (getFakeDomainCheck(mail)) {
+            return mail.getSender() == null || getMailetContext().getMailServers(mail.getSender().getHost()).size() != 0;
+        } else return true;
     }
 }
Index: src/java/org/apache/james/transport/mailets/Bounce.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Bounce.java,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 Bounce.java
--- src/java/org/apache/james/transport/mailets/Bounce.java	6 Jun 2003 23:55:04 -0000	1.1.2.3
+++ src/java/org/apache/james/transport/mailets/Bounce.java	8 Jun 2003 18:26:42 -0000
@@ -98,14 +98,19 @@
  * If the notified message has an "error message" set, it will be inserted into the
  * notification inline text. If the <CODE>attachStackTrace</CODE> init parameter
  * is set to true, such error message will be attached to the notification message.<BR>
- * <P>passThrough is <B>true</B>.</P>
+ * <P>Supports the <CODE>passThrough</CODE> init parameter (true if missing).</P>
  *
  * <P>Sample configuration:</P>
  * <PRE><CODE>
- * &lt;mailet match="All" class="NotifyPostmaster">
+ * &lt;mailet match="All" class="Bounce">
  *   &lt;sendingAddress&gt;<I>an address or postmaster</I>&lt;/sendingAddress&gt;
  *   &lt;attachStackTrace&gt;<I>true or false, default=false</I>&lt;/attachStackTrace&gt;
  *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
+ *   &lt;prefix&gt;<I>optional subject prefix prepended to the original message</I>&lt;/prefix&gt;
+ *   &lt;inline&gt;<I>see {@link Redirect}, default=none</I>&lt;/inline&gt;
+ *   &lt;attachment&gt;<I>see {@link Redirect}, default=message</I>&lt;/attachment&gt;
+ *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
  *
@@ -116,16 +121,21 @@
  *   &lt;sender&gt;<I>an address or postmaster</I>&lt;/sender&gt;
  *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
  *   &lt;message&gt;<I><B>dynamically built</B></I>&lt;/message&gt;
- *   &lt;passThrough&gt;true&lt;/passThrough&gt;
+ *   &lt;prefix&gt;<I>a string</I>&lt;/prefix&gt;
+ *   &lt;passThrough&gt;true or false, default=true&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  *   &lt;recipients&gt;<B>sender</B>&lt;/recipients&gt;
  *   &lt;returnPath&gt;null&lt;/returnPath&gt;
- *   &lt;inline&gt;none&lt;/inline&gt;
- *   &lt;attachment&gt;message&lt;/attachment&gt;
+ *   &lt;inline&gt;see {@link Redirect}, default=NONE&lt;/inline&gt;
+ *   &lt;attachment&gt;see {@link Redirect}, default=message&lt;/attachment&gt;
  *   &lt;isReply&gt;true&lt;/isReply&gt;
  *   &lt;static&gt;true&lt;/static&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
+ * @since 2.2.0
  */
 public class Bounce extends AbstractNotify {
 
Index: src/java/org/apache/james/transport/mailets/Forward.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/Forward.java,v
retrieving revision 1.6.4.4
diff -u -r1.6.4.4 Forward.java
--- src/java/org/apache/james/transport/mailets/Forward.java	6 Jun 2003 23:55:04 -0000	1.6.4.4
+++ src/java/org/apache/james/transport/mailets/Forward.java	8 Jun 2003 18:26:42 -0000
@@ -83,11 +83,14 @@
  * <PRE><CODE>
  * &lt;mailet match="All" class="Redirect">
  *   &lt;passThrough&gt;true or false&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  *   &lt;recipients&gt;comma delimited list of email addresses&lt;/recipients&gt;
  *   &lt;inline&gt;unaltered&lt;/inline&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
  */
 public class Forward extends AbstractRedirect {
 
Index: src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java,v
retrieving revision 1.9.4.5
diff -u -r1.9.4.5 NotifyPostmaster.java
--- src/java/org/apache/james/transport/mailets/NotifyPostmaster.java	6 Jun 2003 23:55:04 -0000	1.9.4.5
+++ src/java/org/apache/james/transport/mailets/NotifyPostmaster.java	8 Jun 2003 18:26:42 -0000
@@ -93,14 +93,19 @@
  * is set to true, such error message will be attached to the notification message.<BR>
  * The notified messages are attached in their entirety (headers and
  * content) and the resulting MIME part type is "message/rfc822".</P>
- * <P>passThrough is <B>true</B>.</P>
+ * <P>Supports the <CODE>passThrough</CODE> init parameter (true if missing).</P>
  *
  * <P>Sample configuration:</P>
  * <PRE><CODE>
  * &lt;mailet match="All" class="NotifyPostmaster">
- *   &lt;sendingAddress&gt;<I>an address or postmaster or sender, default=postmaster</I>&lt;/sendingAddress&gt;
+ *   &lt;sendingAddress&gt;<I>an address or postmaster</I>&lt;/sendingAddress&gt;
  *   &lt;attachStackTrace&gt;<I>true or false, default=false</I>&lt;/attachStackTrace&gt;
  *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
+ *   &lt;prefix&gt;<I>optional subject prefix prepended to the original message, default="Re:"</I>&lt;/prefix&gt;
+ *   &lt;inline&gt;<I>see {@link Redirect}, default=none</I>&lt;/inline&gt;
+ *   &lt;attachment&gt;<I>see {@link Redirect}, default=message</I>&lt;/attachment&gt;
+ *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  *   &lt;to&gt;<I>unaltered (optional, defaults to postmaster)</I>&lt;/to&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
@@ -112,16 +117,20 @@
  *   &lt;sender&gt;<I>an address or postmaster or sender, default=postmaster</I>&lt;/sender&gt;
  *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
  *   &lt;message&gt;<I><B>dynamically built</B></I>&lt;/message&gt;
- *   &lt;passThrough&gt;true&lt;/passThrough&gt;
- *   &lt;to&gt;<I>unaltered or postmaster&lt</I>;/to&gt;
+ *   &lt;prefix&gt;<I>a string</I>&lt;/prefix&gt;
+ *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
+ *   &lt;to&gt;<I><B>unaltered or postmaster</B></I>&lt;/to&gt;
  *   &lt;recipients&gt;<B>postmaster</B>&lt;/recipients&gt;
- *   &lt;inline&gt;none&lt;/inline&gt;
- *   &lt;attachment&gt;message&lt;/attachment&gt;
+ *   &lt;inline&gt;see {@link Redirect}, default=none&lt;/inline&gt;
+ *   &lt;attachment&gt;see {@link Redirect}, default=message&lt;/attachment&gt;
  *   &lt;isReply&gt;true&lt;/isReply&gt;
  *   &lt;static&gt;true&lt;/static&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
  */
 public class NotifyPostmaster extends AbstractNotify {
 
@@ -166,10 +175,14 @@
     }
 
     /**
-     * @return "Re:"
+     * @return the <CODE>prefix</CODE> init parameter or "Re:" if missing
      */
     protected String getSubjectPrefix() {
-        return "Re:";
+        if(getInitParameter("prefix") == null) {
+            return "Re:";
+        } else {
+            return getInitParameter("prefix");
+        }
     }
 
     /**
Index: src/java/org/apache/james/transport/mailets/NotifySender.java
===================================================================
RCS file: /home/cvspublic/jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java,v
retrieving revision 1.10.4.6
diff -u -r1.10.4.6 NotifySender.java
--- src/java/org/apache/james/transport/mailets/NotifySender.java	6 Jun 2003 23:55:04 -0000	1.10.4.6
+++ src/java/org/apache/james/transport/mailets/NotifySender.java	8 Jun 2003 18:26:42 -0000
@@ -93,7 +93,7 @@
  * is set to true, such error message will be attached to the notification message.<BR>
  * The notified messages are attached in their entirety (headers and
  * content) and the resulting MIME part type is "message/rfc822".</P>
- * <P>passThrough is <B>true</B>.</P>
+ * <P>Supports the <CODE>passThrough</CODE> init parameter (true if missing).</P>
  *
  * <P>Sample configuration:</P>
  * <PRE><CODE>
@@ -101,6 +101,11 @@
  *   &lt;sendingAddress&gt;<I>an address or postmaster</I>&lt;/sendingAddress&gt;
  *   &lt;attachStackTrace&gt;<I>true or false, default=false</I>&lt;/attachStackTrace&gt;
  *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
+ *   &lt;prefix&gt;<I>optional subject prefix prepended to the original message</I>&lt;/prefix&gt;
+ *   &lt;inline&gt;<I>see {@link Redirect}, default=none</I>&lt;/inline&gt;
+ *   &lt;attachment&gt;<I>see {@link Redirect}, default=message</I>&lt;/attachment&gt;
+ *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  *   &lt;to&gt;<I>unaltered (optional, defaults to sender)</I>&lt;/to&gt;
  * &lt;/mailet&gt;
  * </CODE></PRE>
@@ -112,7 +117,9 @@
  *   &lt;sender&gt;<I>an address or postmaster</I>&lt;/sender&gt;
  *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
  *   &lt;message&gt;<I><B>dynamically built</B></I>&lt;/message&gt;
+ *   &lt;prefix&gt;<I>a string</I>&lt;/prefix&gt;
  *   &lt;passThrough&gt;true&lt;/passThrough&gt;
+ *   &lt;fakeDomainCheck&gt;<I>true or false, default=true</I>&lt;/fakeDomainCheck&gt;
  *   &lt;to&gt;<I>unaltered or sender&lt</I>;/to&gt;
  *   &lt;recipients&gt;<B>sender</B>&lt;/recipients&gt;
  *   &lt;inline&gt;none&lt;/inline&gt;
@@ -122,6 +129,8 @@
  * &lt;/mailet&gt;
  * </CODE></PRE>
  *
+ * <P>CVS $Id$</P>
+ * @version 2.2.0
  */
 public class NotifySender extends AbstractNotify {
 

