Im sending mails from a web application running on a glassfish server, which was quite easy with the java mail API.
I'm starting now to attach files (mainly pdf and odt) to the mail, which works to, but the mime type of the attachment is not correctly set (application/octet-stream). I tried to attach the file with:
MimeBodyPart mimeBodyPart = new MimeBodyPart();
mimeBodyPart.attachFile(file);
and:
messageBodyPart = new MimeBodyPart();
FileDataSource source = new FileDataSource(file);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(file.getName());
But its the same result. From here i have the hint to place a mime.types file in the META-INF folder of my application but this does not seem to work for me. I tried id in the META-INF of the war and the ear of my application.
Enabling debug for javax.activation gives me this:
INFO: MimetypesFileTypeMap: load HOME
INFO: MimetypesFileTypeMap: load SYS
INFO: MimetypesFileTypeMap: load JAR
INFO: MimetypesFileTypeMap: !anyLoaded
INFO: MimetypesFileTypeMap: not loading mime types file: /META-INF/mime.types
INFO: MimetypesFileTypeMap: load DEF
Where do i have to put the mime.types file or how can a mime types to my web application?
Thanks Raffael