Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#1485730 closed Bugs (duplicate)

misdetected office attachments (detected as text/plain instead of application/vnd-...)

Reported by: niemand Owned by:
Priority: 3 Milestone: later
Component: MIME parsing Version: git-master
Severity: normal Keywords: office attachments misdetected by mime detection code text plain plaintext doc xls patch
Cc: re@…


Even in 0.2-stable, attached MS-Office-Documents (doc, xls, etc.) are still detected as text/plain falsely, so that these attachments are displayed in plaintext bytewise.

The mime-detect.patch ( does not work on 0.2-stable anymore, since there is no program/steps/mail/ anymore and mime detection is made in program/lib/Mail/mime.php now.

A workaround for 0.2-stable is to place the following lines in program/lib/Mail/mime.php at the beginning of function addAttachment(), but i think this fundamental problem should be fixed in general.

if ($c_type='text/plain') {

$mime_ext = array(
'pdf' => 'application/pdf',
'xls' => 'application/',
'xlm' => 'application/',
'xla' => 'application/',
'xlc' => 'application/',
'xlt' => 'application/',
'xlw' => 'application/',
'ppt' => 'application/',
'pps' => 'application/',
'pot' => 'application/',
'doc' => 'application/msword',
'dot' => 'application/msword',
'odc' => 'application/vnd.oasis.opendocument.chart',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'odf' => 'application/vnd.oasis.opendocument.formula',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'odg' => 'application/',
'otg' => 'application/',
'odi' => 'application/vnd.oasis.opendocument.image',
'oti' => 'application/vnd.oasis.opendocument.image-template',
'odp' => 'application/vnd.oasis.opendocument.presentation',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'odt' => 'application/vnd.oasis.opendocument.text',
'otm' => 'application/vnd.oasis.opendocument.text-master',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'oth' => 'application/vnd.oasis.opendocument.text-web',
'docm' => 'application/',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'dotm' => 'application/',
'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template',
'ppsm' => 'application/',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'pptm' => 'application/',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'xlsb' => 'application/',
'xlsm' => 'application/',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xps' => 'application/',
'rar' => 'application/x-rar-compressed'

if ($name) {

$nameprts = split("\.", $name);
$ext = end($nameprts);
if ($ext && isset($mime_ext[$ext]))




Change History (2)

comment:1 Changed 5 years ago by com2

  • Cc re@… added
  • Priority changed from 4 to 3
  • Version changed from 0.2-stable to svn-trunk

I tried svn [9b4aaa79] and it has the same bug. Is especially annoying for Outlook recipients (tested with 2003 and 2007) because it takes the mime type really strict and saves it as plain/text.

comment:2 Changed 5 years ago by thomasb

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #1485311

Note: See TracTickets for help on using tickets.