File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other JSE/JEE APIs and the fly likes SetSubType usage? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "SetSubType usage?" Watch "SetSubType usage?" New topic

SetSubType usage?

Patrick Newell

Joined: Jan 11, 2006
Posts: 2

The code below I put together from old postings on sending emails with attachments. It works as it is but I am wondering whether I should be setting the subType with the method setSubType? I am not sure what setting the subtype does (and cannot a great deal of infomation on it that makes a great deal of sense). Perhaps someone can advise me on what it is and whether I should code it. Also, if it is recommended, how should it be specified? I don't know if its relevant but I plan to send pdf and Word attachments predominantly

Thanks for any advice anyone can offer.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

I send a lot of PDF documents using JavaMail and I do not use that method. I don't know what it does either, but I suspect it refers to the second part of things like "text/html". And the API documentation was clearly written for people who don't need the documentation. At any rate I don't have any problems sending the PDFs.
Patrick Newell

Joined: Jan 11, 2006
Posts: 2
Thanks Paul...wasn't sure if I was missing anything important. For anyone who is interested, I did find some useful information at the following

Understanding Mime

Content Type Header Field

Having read these documents and then looking at the properties of an email
that was sent from Java (that is created via MimeMultipart) I discovered the following (within the properties):

Content-Type: multipart/mixed

...which means that the type of the email message is multipart and the subtype is mixed. Therefore when sending a message of this type, a default must be at work (with the subtype set to mixed).

multipart tells the receiver that the email may contain within the single message a number of seperate data types. Images, video, text documents etc
I agree. Here's the link:
subject: SetSubType usage?
It's not a secret anymore!