I'm working on adding some e-mailing capability to an existing reporting application.
I am able to generate a report and send it using JavaMail, however I can't seem to get the MIME types right. Know know the 5 MIME types I needs for the 5 formats I support, but they all are sent as .dat files. Upon arrival, if I convert the .dat file to the proper extensions(On Windows) then I can open the file just fine.
I tries using the MIMEBodyPart class's setContent method, but it keeps telling me:
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/pdf
It says the same for all my other MIME Types, expect with the correct MIME type listed.
Here is the code:
Please note that getMIMEHeader returns a new javax.mail.Header object that has the value set to the MIMtype String.
Also, recipients is an ArrayList of type String that contains a listing of everyone the e-mail should be send to.
Jon [ December 09, 2008: Message edited by: Jon Parise ]
I don't know if this will help any... I've always used the Apache Commons Email API when working with e-mail. It wraps the Java Mail API. I've always heard that working with the Java Mail API directly can be tricky. I've used Apache Commons Email for attachments as well. At the very least, you might be able to look at their source code (since it's open source) and see how they handle attachments and see if you are missing something. Anyhow, since I had not seen anyone reply to you yet, I thought that suggestion might help.