james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Noel J. Bergman" <n...@devtech.com>
Subject RE: ID-mail
Date Fri, 07 Mar 2003 21:25:53 GMT
> Typically you should not expect that the Message object you get from
> a Folder can be modified.

As per the javadocs, I would check (folder.getMode() == Folder.READ_WRITE),
but if it were true, I would expect that if I were to do:

  if (folder.getMode() == Folder.READ_WRITE)
    MimeMessage msg = folder.getMessage(...);
    String rating = bayesian.check(msg);
    msg.addHeader("X-BAYESIAN-RATING", rating);

that it would work.  And I would also want it to preserve the Message-ID.

> If anyone has a proposal for how to enable the behavior you want,
> without the risk that people will forget to update the Message-ID
> header when they should, I'd be more than happy to consider it.

Sounds reasonable to me.  :-)  Two thoughts for your consideration and

RFC 2822, section 3.6.4 states that "[in] all cases, it is the meaning that
the sender of the message wishes to convey (i.e., whether this is the same
message or a different message) that determines whether or not the
"Message-ID:" field changes, not any particular syntactic difference that
appears (or does not appear) in the message."

You could try a rule that says: "if only headers have changed AND there is a
Message-ID, don't change the Message-ID."  That appears to be consistent
with the RFC.  If I wanted to change the message ID, and had only changed
headers, I could call setHeader, or a special purpose method, to set the
Message-ID.  However, this may not strongly meet your requirement to avoid
the "risk that people will forget to update the Message-ID header when they

Alternatively, to err on the side of caution, I believe that I would
satisfied with the current default handling of the Message-ID header, were
you to add a new MimeMessage.saveChanges(Boolean preserveID) method,
requiring the caller to explicitly say that FOR THIS CALL, do not change the
Message-ID header.  Do not deprecate the current method, because we don't
want to encourage people who don't REALLY know what they want to use the new
method.  This requires the caller to explicitly say "I know what I am doing,
do not change the Message-ID", which should satisfy all requirements.

> Should JavaMail define a ServerMimeMessage that only lets you add
> headers and doesn't let you change anything else?

Again, my problem with subclassing outside of the context of a service
provider is that it doesn't facilitate consistent handling by non-READ_ONLY
folder providers.

	--- Noel

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

View raw message