"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.

CommentFileSizeAuthor
#4 mimemail.698794_02.patch669 bytessgabe
#1 mimemail.698794_01.patch673 bytessgabe

Comments

sgabe’s picture

StatusFileSize
new673 bytes

Patch created for your solution.

sgabe’s picture

Status: Needs review » Reviewed & tested by the community

I applied your patch to 6.x-1.0-alpha1 and works just fine as you described.

mobilis’s picture

Nice! Your one liner looks much nicer than mine too :-)

sgabe’s picture

Version: 6.x-1.0-alpha1 » 7.x-1.x-dev
StatusFileSize
new669 bytes

Fixed identation.

sgabe’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.