Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

why doesn`t setHeader("Content-Type","....") not work???

843830Apr 3 2005
Hello,

i'am trying to create a mail-gateway with javamail and get this problem when i try to set the Content-Type of a message.

First i do this Code-lines:

MimeMessage newMessage = new MimeMessage(mailSession);
newMessage.setFrom(new InternetAddress(this.from));
newMessage.addRecipients(Message.RecipientType.TO,
this.recipients);
newMessage.setSubject(this.subject);
BodyPart messageBP = new MimeBodyPart();
messageBP.setContent(this.bodyText,"text/plain");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBP);
newMessage.setContent(multipart);

After that the Mail has the Content-Type "multipart/mixed"! That is OK. But after these lines i do following lines:

newMessage.setHeader("Content-Type","multipart/mixed; start=DICOMDIR; type=application/dicom");
newMessage.saveChanges();

i've to do this, because i need the parameter start and type for another application, which will receive this message. But after this line these parameter aren't saved. The content-Type is also "multipart/mixed". WHY??? Please help.

Is there another way for changing the header "content-type"?????

Thx,

Timo Bunger from Germany
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2005
Added on Apr 3 2005
0 comments
275 views