I ran into a similar issue...I ended up copying the mail object, and manipulated the new/copied mail objects headers...I.e. for forwarding. It is a pain!
Does this work?
MailHeaders mh = mail.getHeaders(); mh.removeHeader("From"); mh.addHeader("From", "firstname.lastname@example.org");
Note that removeHeader wills remove all headers with a given name, but there are normally only one called "From".
Yep, I think that would work actually, especially since there's only supposed to be 1 FROM address. However, it would be nice to have this in a utility function (or in the setFrom() function).
This begs the questions: What about the rest of the fields? Is there any reason not to have everything in this object read/write? If so, shall I submit a patch?
Sorry, I now see what you are talking about. I am revising all of the Mail APIs at the moment and I will look into including this.