I need to be able to attach emails to the model, specify .eml and .msg files
Paperclip now requires type checking for downloads.
The section of my code that contains these validations 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.'
This last part, EML_MIMETYPE, is for .eml files and is defined as a constant:
EML_MIMETYPE = 'message/rfc822'
I found the correct MIME TYPE for .eml files using the file command in the terminal in the test .eml file:
$ file -b --mime-type ~/Desktop/noname.eml
However, when I do this in a sample .msg file, it returns to me what looks like a damaged MIME type
$ file -b --mime-type ~/Desktop/testemail.msg
>application/CDFV2-corrupt
, http://social.msdn.microsoft.com/Forums/en-US/8efe300d-c917-4be7-a0f3-e620e029842b/what-mime-type-can-i-use-for-msg-files?forum=netfxnetcom MIME- "application/vnd.ms-outlook", ' .
? linux xubuntu 14.04, Rails 3.2.18 ruby โโ1.9.3p392