Author Topic: Message/RFC822 attachments  (Read 7589 times)

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Message/RFC822 attachments
« on: January 28, 2008, 04:21:15 AM »
RoundCube 0.1 RC2 does not show attachments content-type "message/rfc822" (attached email messages).

Has anyone a clue how to fix it?

-Roland
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
Re: Message/RFC822 attachments
« Reply #1 on: January 29, 2008, 10:54:30 AM »
Fixed myself. The problem was that program/steps/mail/sendmail.inc base64 encodes attached message/rfc822 files and program/steps/mail/func.inc did not parse parts of mimetype message/rfc822 which were base 64 encoded.

sendmail.inc fix:

Code: [Select]
// chose transfer encoding --> detect transfer encoding before adding the attachments ...
$charset_7bit = array('ASCII', 'ISO-2022-JP', 'ISO-8859-1', 'ISO-8859-2', 'ISO-8859-15');
$transfer_encoding = in_array(strtoupper($message_charset), $charset_7bit) ? '7bit' : '8bit';

// add stored attachments, if any
if (is_array($_SESSION['compose']['attachments']))
 foreach ($_SESSION['compose']['attachments'] as $attachment){
if(strtolower($attachment['mimetype']) == "message/rfc822"){
$MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, $transfer_encoding, '', $message_charset);
}
else{
$MAIL_MIME->addAttachment($attachment['path'], $attachment['mimetype'], $attachment['name'], true, 'base64', 'attachment', $message_charset);
}
 }

// add submitted attachments
if (is_array($_FILES['_attachments']['tmp_name']))
 foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath){
if(strtolower($files['type'][$i]) == "message/rfc822"){
  $MAIL_MIME->addAttachment($filepath, $files['type'][$i], $files['name'][$i], true, $transfer_encoding, '', $message_charset);
}
else{
  $MAIL_MIME->addAttachment($filepath, $files['type'][$i], $files['name'][$i], true, 'base64', 'attachment', $message_charset);
}
 }

// encoding settings for mail composing

func.inc fix:

Code: [Select]
  // part message/* ... handle base64 encoded message/* parts as file attachments
   else if ($primary_type=='message' && $mail_part->encoding!='base64')
    {
    list($parts, $attachmnts) = rcmail_parse_message($mail_part, $arg, TRUE);
    $a_return_parts = array_merge($a_return_parts, $parts);
    $a_attachments = array_merge($a_attachments, $attachmnts);
    }

-Roland
Regards,
Rosali
__________________
MyRoundcube Project (commercial)