mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-05 04:49:44 +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 string $_body
|
||||||
* @param array $_attachments
|
* @param array $_attachments
|
||||||
* @param string $_date
|
* @param string $_date
|
||||||
* @param string $_rawMailHeader
|
* @param resource $_rawMail
|
||||||
* @param string $_rawMailBody
|
|
||||||
*/
|
*/
|
||||||
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'];
|
$uid = $_GET['uid'];
|
||||||
$partid = $_GET['part'];
|
$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 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)
|
// 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);
|
$subject = $mailClass::adaptSubjectForImport($_subject);
|
||||||
$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
$attachment_file =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
|
||||||
$tmpfile = fopen($attachment_file,'w');
|
$tmpfile = fopen($attachment_file,'w');
|
||||||
fwrite($tmpfile,$message);
|
fseek($_rawMail, 0, SEEK_SET);
|
||||||
|
stream_copy_to_stream($_rawMail, $tmpfile);
|
||||||
fclose($tmpfile);
|
fclose($tmpfile);
|
||||||
$size = filesize($attachment_file);
|
$size = filesize($attachment_file);
|
||||||
$attachments[] = array(
|
$attachments[] = array(
|
||||||
|
@ -2564,8 +2564,6 @@ class mail_compose
|
|||||||
|
|
||||||
// normaly Bcc is only added to recipients, but not as header visible to all recipients
|
// normaly Bcc is only added to recipients, but not as header visible to all recipients
|
||||||
$mail->forceBccHeader();
|
$mail->forceBccHeader();
|
||||||
$sentMailHeader = $mail->getMessageHeader();
|
|
||||||
$sentMailBody = $mail->getMessageBody();
|
|
||||||
}
|
}
|
||||||
// copying mail to folder
|
// copying mail to folder
|
||||||
if (count($folder) > 0)
|
if (count($folder) > 0)
|
||||||
@ -2696,27 +2694,25 @@ class mail_compose
|
|||||||
if (!empty($mailaddresses)) $mailaddresses['from'] = $GLOBALS['egw']->translation->decodeMailHeader($fromAddress);
|
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.
|
// attention: we dont return from infolog/tracker. You cannot check both. cleanups will be done there.
|
||||||
if ($_formData['to_infolog'] == 'on') {
|
if ($_formData['to_infolog'] == 'on') {
|
||||||
$uiinfolog =& CreateObject('infolog.infolog_ui');
|
$uiinfolog = new infolog_ui();
|
||||||
$uiinfolog->import_mail(
|
$uiinfolog->import_mail(
|
||||||
$mailaddresses,
|
$mailaddresses,
|
||||||
$this->sessionData['subject'],
|
$this->sessionData['subject'],
|
||||||
$this->convertHTMLToText($this->sessionData['body']),
|
$this->convertHTMLToText($this->sessionData['body']),
|
||||||
$this->sessionData['attachments'],
|
$this->sessionData['attachments'],
|
||||||
false, // date
|
false, // date
|
||||||
$sentMailHeader, // raw SentMailHeader
|
$mail->getRaw()
|
||||||
$sentMailBody // raw SentMailBody
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($_formData['to_tracker'] == 'on') {
|
if ($_formData['to_tracker'] == 'on') {
|
||||||
$uitracker =& CreateObject('tracker.tracker_ui');
|
$uitracker = new tracker_ui();
|
||||||
$uitracker->import_mail(
|
$uitracker->import_mail(
|
||||||
$mailaddresses,
|
$mailaddresses,
|
||||||
$this->sessionData['subject'],
|
$this->sessionData['subject'],
|
||||||
$this->convertHTMLToText($this->sessionData['body']),
|
$this->convertHTMLToText($this->sessionData['body']),
|
||||||
$this->sessionData['attachments'],
|
$this->sessionData['attachments'],
|
||||||
false, // date
|
false, // date
|
||||||
$sentMailHeader, // raw SentMailHeader
|
$mail->getRaw()
|
||||||
$sentMailBody // raw SentMailBody
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -400,20 +400,21 @@ class egw_mailer extends Horde_Mime_Mail
|
|||||||
unset($e);
|
unset($e);
|
||||||
parent::send(new Horde_Mail_Transport_Null(), true); // true: keep Message-ID
|
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()
|
// code copied from Horde_Mime_Mail::getRaw(), as there is no way to inject charset in
|
||||||
// which is required to encode headers containing non-ascii chars correct
|
// _headers->toString(), which is required to encode headers containing non-ascii chars correct
|
||||||
if ($stream) {
|
if ($stream) {
|
||||||
$hdr = new Horde_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(
|
return Horde_Stream_Wrapper_Combine::getStream(
|
||||||
array($hdr->stream,
|
array($hdr->stream,
|
||||||
$this->getBasePart()->toString(
|
$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