"Content-Type" of an attachment will allways be "application/octet-stream" if the file extension is missing on the locally stored file. An example where this is a problem is when you store files on your server with generated random names, which is normal on upload. The correct filename is stored in a database along with other data such as the user who owns the file.
This is easy to fix by checking the mimetype of the "human" filename (like "essay.pdf") instead of the actual stored name (like "0A3CG4") when possible:
# mimemail.inc, row 140:
$new_file['Content-Type'] = file_get_mimetype($file);
# mimemail.inc, row 140, fix:
if($name!=""){$new_file['Content-Type'] = file_get_mimetype($name);}else{$new_file['Content-Type'] = file_get_mimetype($file);}
I am aware that you can set 'filemime' in the attachment array when calling mimemail(), but this is not working for some reason.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | mimemail.698794_02.patch | 669 bytes | sgabe |
| #1 | mimemail.698794_01.patch | 673 bytes | sgabe |
Comments
Comment #1
sgabe commentedPatch created for your solution.
Comment #2
sgabe commentedI applied your patch to 6.x-1.0-alpha1 and works just fine as you described.
Comment #3
mobilis commentedNice! Your one liner looks much nicer than mine too :-)
Comment #4
sgabe commentedFixed identation.
Comment #5
sgabe commentedCommitted to HEAD.