james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JG...@intraware.de
Subject RE: Adding a header field to a MimeMessage
Date Thu, 12 Sep 2002 05:52:10 GMT

Hello again.

This is not really far from what I did, but it didn't seem to work. The
headerfield was not created.

But what I found out:
It doesn't seem to work on the original message for me. But the following
piece of code works perfectly:


MimeMessage message2 = new MimeMessage(message);

message2.addHeader("Keywords", "blah");
message2.saveChanges();

mail.setMessage(message2);


I do not know, why I couldn't modify anything of the original message. If
it were READ_ONLY an Exception should be thrown. But actually nothing
happens...

Regards,
Johannes






Chris,

This seems like a handy mailet.  Attached is a somewhat modified version
of your code.  Comments have been added, and the formatting has been
adjusted to be consistent with the rest of the code.  Also, the
configuration parameter "header" has been changed to "name" as the
header usually refers to the name and value together.

If no one has any objections I'll add this version of the mailet.

--Peter

> -----Original Message-----
> From: Chris Means [mailto:cmeans@intfar.com]
> Sent: Wednesday, September 11, 2002 4:42 PM
> To: James Developers List
> Subject: RE: Adding a header field to a MimeMessage
>
> The attached mailet seems to work for me under James 2.0a3.
>
> If you James developers want to, please feel free to add it to the
> "package".
>
> Thanks.
>
> -Chris
>
> > -----Original Message-----
> > From: JGrob@intraware.de [mailto:JGrob@intraware.de]
> > Sent: Wednesday, September 11, 2002 7:41 AM
> > To: james-dev@jakarta.apache.org
> > Subject: Adding a header field to a MimeMessage
> >
> >
> >
> > Hello, there.
> >
> > I have the following problem:
> >
> > I either need to change the subject of a message or add a header
field
> > "Keywords" to it.
> > The spool of this processor is  this_mailet -> other_mailet
> >
> > Other_mailet needs specific data in either the subject line or
> > the Keywords
> > field, which are too complicated for the users to type in.
> > So I am writing "this_mailet" to map a short version of the
> > subject line to
> > the complicated one.
> >
> > My problem is:
> >
> > if I call
> >   mimemessage.setHeader("Keywords", str)
> > or
> >   mimemessage.setSubject("complicated stuff")
> >
> > and do a
> >   mimemessage.saveChanges()
> >
> > the message keeps unchanged (old value of subject / no value in
header).
> >
> > What am I doing wrong?
> >
> >
> > Regards
> > Johannes Grob
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:james-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:james-dev-
> help@jakarta.apache.org>

(See attached file: AddHeader.java)--
To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>


Mime
View raw message