/* Need to add Message-ID so we can use it in the index search. */
$draft_headers->addMessageIdHeader();
- $draft_headers = $base->addMimeHeaders($draft_headers);
+ $draft_headers = $base->addMimeHeaders(array('headers' => $draft_headers));
- return $draft_headers->toString(array('charset' => $charset, 'defserver' => $session ? $_SESSION['imp']['maildomain'] : null)) . $base->toString(false);
+ return $draft_headers->toString(array('charset' => $charset, 'defserver' => $session ? $_SESSION['imp']['maildomain'] : null)) . $base->toString(array('headers' => false));
}
/**
/* Generate the message string. */
$fcc = $headers->toString(array('charset' => $charset, 'defserver' => $_SESSION['imp']['maildomain'])) .
- $mime_message->toString(false);
+ $mime_message->toString(array('headers' => false));
$imp_folder = IMP_Folder::singleton();
$type = $part->getType();
$vfs = $conf['compose']['use_vfs'];
- /* Decode the contents. */
- $part->transferDecodeContents();
-
/* Try to determine the MIME type from 1) the extension and
* then 2) analysis of the file (if available). */
if ($type == 'application/octet-stream') {
public function getBody($options = array())
{
if (is_null($this->_mailbox)) {
- return $this->_message->toString(true, !empty($options['stream']));
+ return $this->_message->toString(array('headers' => true, 'stream' => !empty($options['stream'])));
}
try {
* DEFAULT: All data is retrieved.
* 'nocontents' - (boolean) If true, don't add the contents to the part
* DEFAULT: Contents are added to the part
- * 'nodecode' - (boolean) If 'nocontents' is false, and this setting is
- * true, does not transfer decode the contents.
- * DEFAULT: Contents are transfer decoded.
* </pre>
*
* @return Horde_Mime_Part The raw MIME part asked for (reference).
!is_null($part) &&
empty($options['nocontents']) &&
!is_null($this->_mailbox) &&
- !$part->getContentsAsStream()) {
- $part->setContents($this->getBodyPart($id, array('length' => empty($options['length']) ? null : $options['length'], 'stream' => true)));
-
- if (empty($options['nodecode'])) {
- $part->transferDecodeContents();
- }
+ !$part->getContents(array('stream' => true))) {
+ $part->setContents($this->getBodyPart($id, array('length' => empty($options['length']) ? null : $options['length'], 'stream' => true)), array('usestream' => true));
}
return $part;
if (($key != 0) &&
($val != 'message/rfc822') &&
(strpos($val, 'multipart/') === false)) {
- $part = $this->getMIMEPart($key, array('nodecode' => true));
+ $part = $this->getMIMEPart($key);
$message->alterPart($key, $part);
}
}
unset($res['flags'][$pos]);
}
- $uid = $GLOBALS['imp_imap']->ob->append($mbox, array(array('data' => $res['headertext'][0] . $message->toString(false), 'flags' => $res['flags'], 'messageid' => $res['envelope']['message-id'])));
+ $uid = $GLOBALS['imp_imap']->ob->append($mbox, array(array('data' => $res['headertext'][0] . $message->toString(array('headers' => false)), 'flags' => $res['flags'], 'messageid' => $res['envelope']['message-id'])));
} catch (Horde_Imap_Client_Exception $e) {
throw new Horde_Exception(_("An error occured while attempting to strip the attachment."));
}
function _fullMessageTextLength($ob)
{
- $stat = fstat($ob[1]);
- $len = strlen($ob[0]) + $stat['size']);
+ $stat = fseek($ob[1], 0, SEEK_END);
+ $len = strlen($ob[0]) + ftell($ob[1]);
rewind($ob[1]);
return $len;
}
$name .= '.zip';
$type = 'application/zip';
} else {
- $body = $mime->getContentsAsStream();
+ $body = $mime->getContents(array('stream' => true));
$type = $mime->getType(true);
}
break;