• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
A tiny monkey bit me and I got tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic