Author Topic: attachment problem when using ms outlook  (Read 4393 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.


P.S.

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

here is the screenshot of the file:
http://img160.imageshack.us/img160/945/corruptkt7.png

hope you can help me to solve this problem..

thanks..

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?
thanks...

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


Quote

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:

#1
main.inc.php

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

#2
./program/include/rcube_shared.inc ::: 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=http://de2.php.net/manual/en/ref.fileinfo.php]PHP: Fileinfo Functions - Manual[/url]
 * @see    [url=http://de2.php.net/mime_content_type]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);
            finfo_close($finfo);
        }
    }
    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.

Regards,
Roland

P.S.: I'm not a member of the dev crew. If you seem to be stumped please address the issue @ trac.roundcube.net (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 »
Regards,
Rosali
__________________
MyRoundcube Project (commercial)