How do I set the mime type for an attachment to "application/zip"
843830Aug 5 2002 — edited Aug 5 2002I'm sending out an email with a zip file as an attachment. The following code works fine, but the Mimetype for the attachment is set to "application/octet-stream"
FileDataSource fds = new FileDataSource(zipname);
DataHandler dh = new DataHandler(fds);
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.setDataHandler(dh);
mbp2.setFileName(fds.getName());
I would like the mime type to be application/x-zip. Unfortunately I seem to need a data content handler for this mime type as I get this exception.
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/x-zip
Building a date content handler in the activation framework seems like a lot of work to do a very simple thing. Am I missing something obvious? Is there a simple way to do this?