* eMail/Infolog/Tracker: upon converting mails on send, if we attach messages get the message itself, and attach it, as we are able to display it in egw instead of fetching only the attachments attached files (as we did previously)

This commit is contained in:
Klaus Leithoff 2013-10-15 10:48:48 +00:00
parent 10a7d6a7a6
commit 1a02f8cb34

View File

@ -2343,16 +2343,27 @@ class infolog_ui
$mailobject->openConnection();
foreach ($_attachments as $attachment)
{
if ($attachment['type'] == 'MESSAGE/RFC822')
//error_log(__METHOD__.__LINE__.array2string($attachment));
if (trim(strtoupper($attachment['type'])) == 'MESSAGE/RFC822' && !empty($attachment['uid']) && !empty($attachment['folder']))
{
$mailobject->reopen($attachment['folder']);
$mailcontent = $mailClass::get_mailcontent($mailobject,$attachment['uid'],$attachment['partID'],$attachment['folder']);
//_debug_array($mailcontent['attachments']);
foreach($mailcontent['attachments'] as $tmpattach => $tmpval)
{
$attachments[] = $tmpval;
}
// get the message itself, and attach it, as we are able to display it in egw
// instead of fetching only the attachments attached files (as we did previously)
$message = $mailobject->getMessageRawBody($attachment['uid'],$attachment['partID']);
$headers = $mailobject->getMessageHeader($attachment['uid'],$attachment['partID'],true);
$subject = str_replace('$$','__',($headers['SUBJECT']?$headers['SUBJECT']:lang('(no subject)')));
$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
$tmpfile = fopen($attachment_file,'w');
fwrite($tmpfile,$message);
fclose($tmpfile);
$size = filesize($attachment_file);
$attachments[] = array(
'name' => trim($subject).'.eml',
'mimeType' => 'message/rfc822',
'tmp_name' => $attachment_file,
'size' => $size,
);
}
else
{