#1484062 closed Bugs (fixed)
Wrong MimeType while attaching files.
| Reported by: | fjgm | Owned by: | till |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.1-stable |
| Component: | PHP backend | Version: | |
| Severity: | normal | Keywords: | |
| Cc: |
Description
There's a small issue with roundcube while attaching certain files. Roundcube trusts that the browser will send the correct Mimetype which seems fine, but not all browsers do this right.
I have been experiencing problems with Firefox and various versions of roundcube while attaching PDF files because somehow Firefox recognizes them as text/html and not as application/pdf ; when the email composed with roundcube is received the attachment can be downloaded but its imposible to open because the mimetype is wrong.
I was able to fix this behaviour by ignoring the mimetype sent by the browser and forcing the application to query the true mimetype of the file by means of the "mime_content_type()" function.
File: program/steps/mail/sendmail.inc
// add stored attachments, if any
if (is_array($_SESSION['compose']['attachments']))
foreach ($_SESSION['compose']['attachments'] as $attachment)
$MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], TRUE);
Was replaced with:
// add stored attachments, if any
if (is_array($_SESSION['compose']['attachments']))
foreach ($_SESSION['compose']['attachments'] as $attachment)
$MAIL_MIME->addAttachment($attachment['path'], mime_content_type($attachment['path']), $attachment['name'], TRUE);
Change History (2)
comment:1 Changed 5 years ago by till
- Milestone set to 0.1-stable
- Owner set to till
- Status changed from new to assigned
comment:2 Changed 5 years ago by till
- Resolution set to fixed
- Status changed from assigned to closed

Fixed in [75f0a738]!