Noel J. Bergman wrote:
+ Iterator headers = sa.getHeaders().keySet().iterator();
+ // Add the headers
+ while (headers.hasNext()) {
+   String key = headers.next().toString();
+   message.setHeader(key, (String) sa.getHeaders().get(key));
+ }

Do we want to add the header's now, or set attributes that we can map to 
headers later?  Personally, I'm leaning towards the latter.  We might even have 
a generic mailet along the lines:

  <mailet match="All" class="Attributes2Headers">
    <attribute name="org.apache.james.SpamAssassin-Status>
      <header>X-Spam-Status</header>
      <mapping> <!-- optional (see AbstractVirtualUser.regexMap for idea) -->
        <regex>...</regex> <!-- regex to match against attribute value -->
        <value>...</value> <!-- parameterized string to build header   -->
      </mapping>
    </attribute>
    <attribute name="...">
      ...
    </attribute>
  </mailet

This would give us more control over header names and content (if there were no 
mapping element, the value would be copied directly).  For example, the ASF 
version of the header looks like:

  X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME

And it would also be more efficient, since we could modify the message just 
once, rather than each time we want to add meta-data.

I agree on this.
We should not touch the MimeMessage if possible, and only store mail attributes that give us much more flexibility. About the Attributes2Headers I would name it MailAttributesToMimeHeaders and I would probably skip the regex part for the first version.

Stefano


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

Reply via email to