• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javamail: Retrieve text/plain part of an multipart/alternative message?

 
Ron Spaulding
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I sent an mail as "multipart/alternative" using Googlemail. If I check the properties of the mail in Outlook 2007 (right-click on message -> properties) it also shows up as multipart/alternative.
However if I retrieve the mail using Javamail (from an MS Exchange-Server) the contenttype of the message is "text/html" :-(

My question is therefore how to obtain the original multipart-message or the text/plain part?

Cheers,
Spaulding

PS: For security reasons I do not want to deal with html messages. Therefore my program should only accept mails in text/plain format...
 
Paul Clapham
Sheriff
Posts: 21111
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With your JavaMail download there is a directory of example programs. One is a program to extract all of the parts from a message. Run that program on your multipart/alternative message and see if there is a text/plain part hidden inside it.
 
Ron Spaulding
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are probably referring to "mgsshow.java"?

I already checked that and even there it's showing up as text/html only...
 
Paul Clapham
Sheriff
Posts: 21111
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Spaulding wrote:You are probably referring to "mgsshow.java"?


Yes.

I already checked that and even there it's showing up as text/html only...


Really? You would think that a "multipart" message would have more than one part. However I've never had to process an incoming multipart/alternative message via JavaMail myself, so I have no expertise to add at this time.
 
Ron Spaulding
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the problem is the MS Exchange-Server.
Instead of sending the multipart/alternative messages it just sends the text/html one... Is there a way to tell the server that the client does not understand text/html messages?


However I've never had to process an incoming multipart/alternative message via JavaMail myself, so I have no expertise to add at this time.


Nevertheless your help is greatly appreciated.
 
Paul Clapham
Sheriff
Posts: 21111
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ron Spaulding wrote:I think the problem is the MS Exchange-Server.
Instead of sending the multipart/alternative messages it just sends the text/html one... Is there a way to tell the server that the client does not understand text/html messages?


I don't know... there's a lot of IMAP properties you could set, you can read about them in this API docs page.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic