diff --git a/emailadmin/inc/class.emailadmin_imapbase.inc.php b/emailadmin/inc/class.emailadmin_imapbase.inc.php index b9fa65f95d..dfb0bab450 100644 --- a/emailadmin/inc/class.emailadmin_imapbase.inc.php +++ b/emailadmin/inc/class.emailadmin_imapbase.inc.php @@ -6023,7 +6023,7 @@ class emailadmin_imapbase * parseRawMessageIntoMailObject - parses a message/rfc mail from file to the mailobject and returns the header and body via reference * throws egw_exception_assertion_failed when the required Pear Class is not found/loadable * @param object $mailObject instance of the SMTP Mailer Object - * @param string $message string containing the RawMessage + * @param mixed string/object $message string containing the RawMessage / object Mail_mimeDecoded message (part)) * @param string &$Header reference used to return the imported Mailheader * @param string &$Body reference to return the imported Body * @return void Mailheader and body is returned via Reference in $Header $Body @@ -6038,8 +6038,15 @@ class emailadmin_imapbase //echo '
'.$message.''; //error_log(__METHOD__.' ('.__LINE__.') '.$message); if (class_exists('Mail_mimeDecode',false)==false && (@include_once 'Mail/mimeDecode.php') === false) throw new egw_exception_assertion_failed(lang('Required PEAR class Mail/mimeDecode.php not found.')); - $mailDecode = new Mail_mimeDecode($message); - $structure = $mailDecode->decode(array('include_bodies'=>true,'decode_bodies'=>true,'decode_headers'=>true)); + if (is_string($message)) + { + $mailDecode = new Mail_mimeDecode($message); + $structure = $mailDecode->decode(array('include_bodies'=>true,'decode_bodies'=>true,'decode_headers'=>true)); + } + if (is_object($message)) + { + $structure = $message; + } //error_log(__METHOD__.' ('.__LINE__.') '.array2string($structure)); //_debug_array($structure); //exit; @@ -6272,8 +6279,8 @@ class emailadmin_imapbase //error_log( __METHOD__.' ('.__LINE__.') '." Recursion to fetch subparts:".$part->ctype_primary.'/'.$part->ctype_secondary); $this->createBodyFromStructure($mailObject, $part, $parenttype=null, $decode); } - //error_log(__METHOD__.' ('.__LINE__.') '.$structure->ctype_primary.'/'.$structure->ctype_secondary.' => '.$part->ctype_primary.'/'.$part->ctype_secondary.' Part:'.array2string($part)); - if ($part->body && ((strtolower($structure->ctype_secondary)=='mixed' && strtolower($part->ctype_primary)!='multipart') || + //error_log(__METHOD__.' ('.__LINE__.') '.$structure->ctype_primary.'/'.$structure->ctype_secondary.' => '.$part->ctype_primary.'/'.$part->ctype_secondary.' Part:'.array2string($part->body)); + if (($part->body||strtolower($part->ctype_primary.'/'.$part->ctype_secondary)=="message/rfc822") && ((strtolower($structure->ctype_secondary)=='mixed' && strtolower($part->ctype_primary)!='multipart') || trim(strtolower($part->disposition)) == 'attachment' || trim(strtolower($part->disposition)) == 'inline' || isset($part->headers['content-id']))) @@ -6347,12 +6354,26 @@ class emailadmin_imapbase } else { - //error_log(__METHOD__.' ('.__LINE__.') '.' Add String '.($part->disposition=='attachment'?'Attachment':'Part').' of type:'.$part->ctype_primary.'/'.$part->ctype_secondary); - $mailObject->AddStringAttachment($part->body, //($part->headers['content-transfer-encoding']?base64_decode($part->body):$part->body), + //error_log(__METHOD__.' ('.__LINE__.') '.' Add String '.($part->disposition=='attachment'?'Attachment':'Part').' of type:'.$part->ctype_primary.'/'.$part->ctype_secondary.array2string($part->parts)); + if (strtolower($part->ctype_primary.'/'.$part->ctype_secondary)=="message/rfc822") + { + $localMailObject = new egw_mailer(); + $this->parseRawMessageIntoMailObject($localMailObject,$part->parts[0],$_Header,$_Body); + //error_log(__METHOD__.__LINE__.$_Header.$localMailObject->LE.$localMailObject->LE.$_Body); + $mailObject->AddStringAttachment($_Header.$localMailObject->LE.$localMailObject->LE.$_Body, $filename, ($part->headers['content-transfer-encoding']?$part->headers['content-transfer-encoding']:'base64'), $part->ctype_primary.'/'.$part->ctype_secondary ); + } + else + { + $mailObject->AddStringAttachment($part->body, //($part->headers['content-transfer-encoding']?base64_decode($part->body):$part->body), + $filename, + ($part->headers['content-transfer-encoding']?$part->headers['content-transfer-encoding']:'base64'), + $part->ctype_primary.'/'.$part->ctype_secondary + ); + } } } if (!(trim(strtolower($part->disposition))=='attachment' || trim(strtolower($part->disposition)) == 'inline' || isset($part->headers['content-id'])) && $partFetched==false) diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 6944229939..be17fe8b31 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -455,10 +455,10 @@ class mail_ui //$content[self::$nm_index]['path'] = self::get_home_dir(); } } - else if ($content['mailPreview']['mailPreviewHeadersAttachments']['previewAttachmentArea'][0]['save_zip']) - { - $this->download_zip(current($content[self::$nm_index]['selected'])); - } +// else if ($content['mailPreview']['mailPreviewHeadersAttachments']['previewAttachmentArea'][0]['save_zip']) +// { +// $this->download_zip(current($content[self::$nm_index]['selected'])); +// } //$content[self::$nm_index]['default_cols'] = 'status,attachments,subject,'.($toSchema?'toaddress':'fromaddress').',date,size'; // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns $content[self::$nm_index]['default_cols'] = 'status,attachments,subject,address,date,size'; // I columns to use if there's no user or default pref (! as first char uses all but the named columns), default all columns $content[self::$nm_index]['csv_fields'] = false; @@ -2100,10 +2100,10 @@ class mail_ui $rowID = $_requesteddata['id']; //unset($_REQUEST); } - if($_requesteddata['mail_displayattachments'][0]['save_zip']) - { - $this->download_zip($_requesteddata['mail_id']); - } +// if($_requesteddata['mail_displayattachments'][0]['save_zip']) +// { +// $this->download_zip($_requesteddata['mail_id']); +// } $preventRedirect=false; if(isset($_GET['id'])) $rowID = $_GET['id']; if(isset($_GET['part'])) $partID = $_GET['part']; @@ -2279,6 +2279,7 @@ class mail_ui $linkData = array ( 'menuaction' => 'mail.mail_ui.displayMessage', + //'mode' => 'display', //message/rfc822 attachments should be opened in display mode 'id' => $rowID, 'part' => $value['partID'], 'is_winmail' => $value['is_winmail'] diff --git a/mail/js/app.js b/mail/js/app.js index bc861224e0..55f8dfe705 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -2012,6 +2012,7 @@ app.classes.mail = AppJS.extend( { case 'MESSAGE/RFC822': url += 'menuaction=mail.mail_ui.displayMessage'; // todo compose for Draft folder + url += '&mode=display';//message/rfc822 attachments should be opened in display mode url += '&id='+mailid; url += '&part='+attgrid.partID; url += '&is_winmail='+attgrid.winmailFlag;