mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 23:29:31 +01:00
fixing the fix, we dont want whole mails in memory
This commit is contained in:
parent
d411dd0658
commit
2e5fcbda4e
@ -2456,10 +2456,9 @@ class infolog_ui
|
||||
* @param string $_body
|
||||
* @param array $_attachments
|
||||
* @param string $_date
|
||||
* @param string $_rawMailHeader
|
||||
* @param string $_rawMailBody
|
||||
* @param resource $_rawMail
|
||||
*/
|
||||
function import_mail($_to_emailAddress=false,$_subject=false,$_body=false,$_attachments=false,$_date=false,$_rawMailHeader=null,$_rawMailBody=null)
|
||||
function import_mail($_to_emailAddress=false,$_subject=false,$_body=false,$_attachments=false,$_date=false,$_rawMail=null)
|
||||
{
|
||||
$uid = $_GET['uid'];
|
||||
$partid = $_GET['part'];
|
||||
@ -2547,13 +2546,13 @@ class infolog_ui
|
||||
}
|
||||
// this one adds the mail itself (as message/rfc822 (.eml) file) to the infolog as additional attachment
|
||||
// this is done to have a simple archive functionality (ToDo: opening .eml in email module)
|
||||
if ($_rawMailHeader && $_rawMailBody && $GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw')
|
||||
if (is_resource($_rawMail) && $GLOBALS['egw_info']['user']['preferences'][$sessionLocation]['saveAsOptions']==='add_raw')
|
||||
{
|
||||
$message = ltrim(str_replace("\n","\r\n",$_rawMailHeader)).str_replace("\n","\r\n",$_rawMailBody);
|
||||
$subject = $mailClass::adaptSubjectForImport($_subject);
|
||||
$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
||||
$tmpfile = fopen($attachment_file,'w');
|
||||
fwrite($tmpfile,$message);
|
||||
fseek($_rawMail, 0, SEEK_SET);
|
||||
stream_copy_to_stream($_rawMail, $tmpfile);
|
||||
fclose($tmpfile);
|
||||
$size = filesize($attachment_file);
|
||||
$attachments[] = array(
|
||||
|
@ -2564,8 +2564,6 @@ class mail_compose
|
||||
|
||||
// normaly Bcc is only added to recipients, but not as header visible to all recipients
|
||||
$mail->forceBccHeader();
|
||||
$sentMailHeader = $mail->getMessageHeader();
|
||||
$sentMailBody = $mail->getMessageBody();
|
||||
}
|
||||
// copying mail to folder
|
||||
if (count($folder) > 0)
|
||||
@ -2696,27 +2694,25 @@ class mail_compose
|
||||
if (!empty($mailaddresses)) $mailaddresses['from'] = $GLOBALS['egw']->translation->decodeMailHeader($fromAddress);
|
||||
// attention: we dont return from infolog/tracker. You cannot check both. cleanups will be done there.
|
||||
if ($_formData['to_infolog'] == 'on') {
|
||||
$uiinfolog =& CreateObject('infolog.infolog_ui');
|
||||
$uiinfolog = new infolog_ui();
|
||||
$uiinfolog->import_mail(
|
||||
$mailaddresses,
|
||||
$this->sessionData['subject'],
|
||||
$this->convertHTMLToText($this->sessionData['body']),
|
||||
$this->sessionData['attachments'],
|
||||
false, // date
|
||||
$sentMailHeader, // raw SentMailHeader
|
||||
$sentMailBody // raw SentMailBody
|
||||
$mail->getRaw()
|
||||
);
|
||||
}
|
||||
if ($_formData['to_tracker'] == 'on') {
|
||||
$uitracker =& CreateObject('tracker.tracker_ui');
|
||||
$uitracker = new tracker_ui();
|
||||
$uitracker->import_mail(
|
||||
$mailaddresses,
|
||||
$this->sessionData['subject'],
|
||||
$this->convertHTMLToText($this->sessionData['body']),
|
||||
$this->sessionData['attachments'],
|
||||
false, // date
|
||||
$sentMailHeader, // raw SentMailHeader
|
||||
$sentMailBody // raw SentMailBody
|
||||
$mail->getRaw()
|
||||
);
|
||||
}
|
||||
/*
|
||||
|
@ -400,20 +400,21 @@ class egw_mailer extends Horde_Mime_Mail
|
||||
unset($e);
|
||||
parent::send(new Horde_Mail_Transport_Null(), true); // true: keep Message-ID
|
||||
}
|
||||
// code copied from Horde_Mime_Mail, as there is no way to inject charset in _headers->toString()
|
||||
// which is required to encode headers containing non-ascii chars correct
|
||||
// code copied from Horde_Mime_Mail::getRaw(), as there is no way to inject charset in
|
||||
// _headers->toString(), which is required to encode headers containing non-ascii chars correct
|
||||
if ($stream) {
|
||||
$hdr = new Horde_Stream();
|
||||
$hdr->add($this->_headers->toString(array('charset' => 'utf-8')), true);
|
||||
$hdr->add($this->_headers->toString(array('charset' => 'utf-8', 'canonical' => true)), true);
|
||||
return Horde_Stream_Wrapper_Combine::getStream(
|
||||
array($hdr->stream,
|
||||
$this->getBasePart()->toString(
|
||||
array('stream' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT | Horde_Mime_Part::ENCODE_8BIT | Horde_Mime_Part::ENCODE_BINARY))
|
||||
array('stream' => true, 'canonical' => true, 'encode' => Horde_Mime_Part::ENCODE_7BIT | Horde_Mime_Part::ENCODE_8BIT | Horde_Mime_Part::ENCODE_BINARY))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return $this->_headers->toString(array('charset' => 'utf-8')) . $this->getBasePart()->toString();
|
||||
return $this->_headers->toString(array('charset' => 'utf-8', 'canonical' => true)) .
|
||||
$this->getBasePart()->toString(array('canonical' => true));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user