I need to be able to attach emails to a model, specifcally .eml and .msg files
Paperclip now requires validations of the types of files upload with it.
The section of my code where those validations live is here:
validates_attachment_content_type :supporting_document,
:content_type => ['application/pdf', 'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'image/jpeg', 'image/jpg', 'image/png',
'application/vnd.ms-excel.sheet.macroEnabled.12', 'application/msword',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',EML_MIMETYPE],
:message => 'incorrect file type.'
That last part, EML_MIMETYPE, is for .eml files, and is defined as a constant:
EML_MIMETYPE = 'message/rfc822'
I found the proper MIME TYPE for .eml files by using the file command in the terminal on a test .eml file:
$ file -b --mime-type ~/Desktop/noname.eml
However, when I do this on a sample .msg file, it give me back what looks like a corrupted MIME type
$ file -b --mime-type ~/Desktop/testemail.msg
>application/CDFV2-corrupt
Looking online, this link http://social.msdn.microsoft.com/Forums/en-US/8efe300d-c917-4be7-a0f3-e620e029842b/what-mime-type-can-i-use-for-msg-files?forum=netfxnetcom suggested maybe using a MIME type of "application/vnd.ms-outlook" , but I've had no luck.
Any suggestions? I am running linux xubuntu 14.04, and the app is using Rails 3.2.18 and ruby 1.9.3p392