How can I remove headers in JavaMail?

Dieter Wimberger

The MimeMessage has a method called
removeHeader(String name)
This will remove all headers with a given name.
Note that the folder the message is in will have to be opened READ_WRITE at the point of modification.
Probably you will want to make a copy and work on the copy
MimeMessage(MimeMessage source)