Author Topic: attachment problem when using ms outlook  (Read 2870 times)

Offline raztybaby

  • Newbie
  • *
  • Posts: 9
attachment problem when using ms outlook
« on: February 06, 2009, 10:17:03 PM »
hi, i upgraded my roundcube into the latest version and it works fine.. but when i emailed my friend and an attachment of word document and excel file using the roundcube webmail he can't open the attachment because the file is corrupted.. he uses outlook.


There is no problem when you downloaded the file using roundcube mail.

here is the screenshot of the file:

hope you can help me to solve this problem..


Offline pixelzauber

  • Newbie
  • *
  • Posts: 1
attachment problem when using ms outlook
« Reply #1 on: February 10, 2009, 04:23:09 AM »
Hi, i have absolute the same problem!
Has anyone an idea?

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
attachment problem when using ms outlook
« Reply #2 on: February 10, 2009, 04:58:52 AM »
Please see my private messaging with ratzybaby regarding this issue:

Re: attachment problem


Thank you for your spending your time even though you are not part of the dev team..
i ve changed the directory of the mime_magic but still the problem was not solved.. i am going to tweak the php function this my last resort but the bad thing is that i am not so familiar with php...

Thank you very much...


Originally Posted by rosali
I have examined the mail you sent me with the msword attachment. The content type is text/plain while it should be application/msword.

This means that RoundCube does not detect the correct mime type of the attachment when uploading the file. Possible reasons are:


Code: [Select]

// mime magic database
$rcmail_config['mime_magic'] = '/usr/share/misc/magic';

... does not point to mime magic database (look into your PHP folder where it is ...)

./program/include/ ::: function rc_mime_content_type

Code: [Select]

 * A method to guess the mime_type of an attachment.
 * @param string $path     Path to the file.
 * @param string $failover Mime type supplied for failover.
 * @return string
 * @author Till Klampaeckel
 * @see    [url=]PHP: Fileinfo Functions - Manual[/url]
 * @see    [url=]PHP: mime_content_type - Manual[/url]
function rc_mime_content_type($path, $failover = 'application/octet-stream')
    $mime_type = null;
    $mime_magic = rcmail::get_instance()->config->get('mime_magic');

    if (!extension_loaded('fileinfo')) {
        @dl('fileinfo.' . PHP_SHLIB_SUFFIX);

    if (function_exists('finfo_open')) {
        if ($finfo = finfo_open(FILEINFO_MIME, $mime_magic)) {
            $mime_type = finfo_file($finfo, $path);
    if (!$mime_type && function_exists('mime_content_type')) {
      $mime_type = mime_content_type($path);
    if (!$mime_type) {
        $mime_type = $failover;

    return $mime_type;

If this function still fails after correcting the mime magic path, there is something wrong in your PHP setup regarding the PHP functions "finfo_open" and/or "mime_content_type". Please refer to PHP: Hypertext Preprocessor.

For the case you can't get it working by providing a proper PHP setup, then modify the function rc_mime_type to detect the mime_type from the informations in the $_FILES array. This is only a workaround, because $_FILES array detects the mime type from the file extension without scanning the file itself. So the mime type could be faked (upload of arbitary code as text/plain to force inline display).

Sorry, I can't help more than that. I'm not here to tweak your PHP setup.


P.S.: I'm not a member of the dev crew. If you seem to be stumped please address the issue @ (ticket or support mailing list) providing the informations I gave you regarding the issue. Mime type detecting has been changed serveral times due to insufficent PHP setups.
« Last Edit: February 11, 2009, 12:57:05 AM by rosali »
MyRoundcube Project (commercial)