本文整理汇总了PHP中Zend_Mime_Decode类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mime_Decode类的具体用法?PHP Zend_Mime_Decode怎么用?PHP Zend_Mime_Decode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Mime_Decode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testSplitHeaderFieldReturnsArrayWithFirstName
public function testSplitHeaderFieldReturnsArrayWithFirstName()
{
$boundary = "----=_Alternative_1211565553483705f1280701.15526894A";
$header = "Content-Type: multipart/alternative; " . "boundary=\"{$boundary}\"";
$split = Zend_Mime_Decode::splitHeaderField($header, null, 'content-type');
$this->assertEquals(2, count($split));
$this->assertTrue(isset($split['content-type']), "'content-type' element is set");
$this->assertEquals($boundary, $split['boundary']);
}
开发者ID:Tony133,项目名称:zf-web,代码行数:9,代码来源:DecodeTest.php
示例2: __construct
/**
* Public constructor
*
* @param string $rawMessage full message with or without headers
* @param array $headers optional headers already seperated from body
*/
public function __construct($rawMessage, $headers = null)
{
if ($headers) {
if (is_array($headers)) {
$this->_headers = $headers;
$this->_content = $rawMessage;
} else {
Zend_Mime_Decode::splitMessage($headers, $this->_headers, $null);
$this->_content = $rawMessage;
}
} else {
Zend_Mime_Decode::splitMessage($rawMessage, $this->_headers, $this->_content);
}
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:20,代码来源:Message.php
示例3: checkNewsletterSignOutMail
/**
* Wait for newsletter sign out mail
*
* @param array $userAccount
*/
public function checkNewsletterSignOutMail($userAccount)
{
/* Check for mail */
$newsletterUnsubscribeTemplateSubject = $this->__('Newsletter unsubscription success');
// replace markers with information from $userAccount
$subject = $newsletterUnsubscribeTemplateSubject;
foreach ($userAccount as $key => $value) {
$subject = str_replace('###' . strtoupper($key) . '###', $value, $subject);
}
$idx = $this->waitForMailWhoseSubjectContains($subject);
$message = $this->getStorage()->getMessage($idx);
$content = Zend_Mime_Decode::decodeQuotedPrintable($message->getContent());
$this->getStorage()->removeMessage($idx);
$this->getTest()->assertContains('unsubscription success', $content);
}
开发者ID:aoepeople,项目名称:menta_magentocomponents,代码行数:20,代码来源:ImapMail.php
示例4: testSplitMessage
public function testSplitMessage()
{
$header = 'Test: test';
$body = 'body';
$newlines = array("\r\n", "\n\r", "\n", "\r");
foreach ($newlines as $contentEOL) {
foreach ($newlines as $decodeEOL) {
$content = $header . $contentEOL . $contentEOL . $body;
$decoded = Zend_Mime_Decode::splitMessage($content, $decoded_header, $decoded_body, $decodeEOL);
$this->assertEquals(array('test' => 'test'), $decoded_header);
$this->assertEquals($body, $decoded_body);
}
}
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:14,代码来源:MessageTest.php
示例5: testSpaceInFieldName
public function testSpaceInFieldName()
{
$header = 'test; foo =bar; baz =42';
$this->assertEquals(Zend_Mime_Decode::splitHeaderField($header, 'foo'), 'bar');
$this->assertEquals(Zend_Mime_Decode::splitHeaderField($header, 'baz'), 42);
}
开发者ID:sasezaki,项目名称:mirror-zf1-tests,代码行数:6,代码来源:MessageTest.php
示例6: getMailContent
/**
* get content for mail whose content contains the given string and delete the mail then
*
* @param string $subjectContains
* @param bool $useXPath
* @param int $timeout
* @param int $sleep
* @return mixed string|DOMXPath
*/
public function getMailContent($subjectContains, $useXPath = false, $timeout = 100, $sleep = 10)
{
$idx = $this->waitForMailWhoseSubjectContains($subjectContains, $timeout, $sleep);
$message = $this->getStorage()->getMessage($idx);
$content = Zend_Mime_Decode::decodeQuotedPrintable($message->getContent());
$this->getTest()->assertNotEmpty($content);
$this->getStorage()->removeMessage($idx);
if ($useXPath) {
preg_match('/<body.*<\\/body>/misU', $content, $match);
$html = str_replace(array('<', '>'), array('<', '>'), htmlentities($match[0], ENT_NOQUOTES));
return new DOMXPath(DOMDocument::loadHTML($html));
}
return $content;
}
开发者ID:aoepeople,项目名称:menta_generalcomponents,代码行数:23,代码来源:ImapMail.php
示例7: createFromMessage
/**
* Decodes a MIME encoded string and returns a Zend_Mime_Message object with
* all the MIME parts set according to the given string
*
* @param string $message
* @param string $boundary
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
* @return Zend_Mime_Message
*/
public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND)
{
require_once 'Zend/Mime/Decode.php';
$parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL);
$res = new self();
foreach ($parts as $part) {
// now we build a new MimePart for the current Message Part:
$newPart = new Zend_Mime_Part($part['body']);
foreach ($part['header'] as $key => $value) {
/**
* @todo check for characterset and filename
*/
switch (strtolower($key)) {
case 'content-type':
$newPart->type = $value;
break;
case 'content-transfer-encoding':
$newPart->encoding = $value;
break;
case 'content-id':
$newPart->id = trim($value, '<>');
break;
case 'content-disposition':
$newPart->disposition = $value;
break;
case 'content-description':
$newPart->description = $value;
break;
case 'content-location':
$newPart->location = $value;
break;
case 'content-language':
$newPart->language = $value;
break;
default:
throw new Zend_Exception('Unknown header ignored for MimePart:' . $key);
}
}
$res->addPart($newPart);
}
return $res;
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:51,代码来源:Message.php
示例8: getHeaderField
/**
* Get a specific field from a header like content type or all fields as array
*
* If the header occurs more than once, only the value from the first header
* is returned.
*
* Throws a Zend_Mail_Exception if the requested header does not exist. If
* the specific header field does not exist, returns null.
*
* @param string $name name of header, like in getHeader()
* @param string $wantedPart the wanted part, default is first, if null an array with all parts is returned
* @param string $firstName key name for the first part
* @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
* @throws Zend_Exception, Zend_Mail_Exception
*/
public function getHeaderField($name, $wantedPart = 0, $firstName = 0)
{
return Zend_Mime_Decode::splitHeaderField(current($this->getHeader($name, 'array')), $wantedPart, $firstName);
}
开发者ID:bartolomeu,项目名称:estoque_gusella,代码行数:19,代码来源:Part.php
示例9: testSplitInvalidMessage
public function testSplitInvalidMessage()
{
try {
Zend_Mime_Decode::splitMessageStruct("--xxx\n", 'xxx');
} catch (Zend_Exception $e) {
return;
// ok
}
$this->fail('no exception raised while decoding invalid message');
}
开发者ID:jorgenils,项目名称:zend-framework,代码行数:10,代码来源:MessageTest.php
示例10: getRawContent
public function getRawContent($id, $part = null)
{
if ($part !== null) {
// TODO: implement
/**
* @see Zend_Mail_Storage_Exception
*/
require_once PHP_LIBRARY_PATH . 'Zend/Mail/Storage/Exception.php';
throw new Zend_Mail_Storage_Exception('not implemented');
}
$content = $this->_protocol->retrieve($id);
// TODO: find a way to avoid decoding the headers
Zend_Mime_Decode::splitMessage($content, $null, $body);
return $body;
}
开发者ID:netixx,项目名称:Stock,代码行数:15,代码来源:Pop3.php
示例11: _processDeliveryStatus
protected function _processDeliveryStatus($deliveryStatus, $textContent, $originalContent)
{
$statusContent = preg_replace('#\\r?\\n\\r?\\n#', "\n", trim($deliveryStatus));
Zend_Mime_Decode::splitMessage($statusContent, $statusFields, $null);
foreach ($statusFields as &$value) {
if (is_array($value)) {
$value = reset($value);
}
}
if (!empty($statusFields['action'])) {
$this->_action = strtolower($statusFields['action']);
if ($this->_action == 'failed') {
$this->_messageType = 'bounce';
} else {
if ($this->_action == 'delayed') {
$this->_messageType = 'delay';
}
}
}
if (!empty($statusFields['status']) && preg_match('/(\\d\\.\\d\\.\\d)/', $statusFields['status'], $match)) {
$this->_statusCode = $match[1];
}
if (!empty($statusFields['diagnostic-code'])) {
$this->_diagnosticInfo = preg_replace('#^.+;\\s*#U', '', $statusFields['diagnostic-code']);
if (!$this->_statusCode || $this->isStatusCodeAmbiguous($this->_statusCode)) {
if (preg_match('/(\\D|^)(\\d\\.\\d\\.\\d)(\\D|$)/', $this->_diagnosticInfo, $match)) {
$this->_statusCode = $match[2];
}
}
}
if ($this->_action == 'failed' && $this->_diagnosticInfo && $this->_isMailboxInvalid($this->_diagnosticInfo)) {
$this->_statusCode = '5.1.1';
} else {
if ($this->isStatusCodeAmbiguous($this->_statusCode) && $this->_diagnosticInfo && $this->_isMailboxQuotaExceeded($this->_diagnosticInfo)) {
$this->_statusCode = '5.2.2';
} else {
if ($this->_statusCode == '4.7.0' && $this->_isChallengeResponse($textContent) || $this->isStatusCodeAmbiguous($this->_statusCode) && $this->_diagnosticInfo && $this->_isChallengeResponse($this->_diagnosticInfo)) {
$this->_messageType = 'challenge';
$this->_statusCode = null;
$this->_action = null;
}
}
}
}
开发者ID:Sywooch,项目名称:forums,代码行数:44,代码来源:BounceParser.php
示例12: getSummary
/**
* get messages summary
*
* @param int $from
* @param int|null $to
* @return array with $this->_messageClass (Felamimail_Message)
*/
public function getSummary($from, $to = null, $_useUid = null, $_folderId = NULL)
{
$useUid = $_useUid === null ? $this->_useUid : (bool) $_useUid;
$summary = $this->_protocol->fetch(array('UID', 'FLAGS', 'RFC822.HEADER', 'INTERNALDATE', 'RFC822.SIZE', 'BODYSTRUCTURE'), $from, $to, $useUid);
// fetch returns a different structure when fetching one or multiple messages
if ($to === null && ctype_digit("{$from}")) {
$summary = array($from => $summary);
}
$messages = array();
foreach ($summary as $id => $data) {
$header = $this->_fixHeader($data['RFC822.HEADER'], $id, $spaces);
Zend_Mime_Decode::splitMessage($header, $header, $null);
$structure = $this->parseStructure($data['BODYSTRUCTURE']);
$flags = array();
foreach ($data['FLAGS'] as $flag) {
$flags[] = isset(self::$_knownFlags[$flag]) ? self::$_knownFlags[$flag] : $flag;
}
if ($this->_useUid === true) {
$key = $data['UID'];
} else {
$key = $id;
}
$messages[$key] = array('header' => $header, 'flags' => $flags, 'received' => $data['INTERNALDATE'], 'size' => $data['RFC822.SIZE'], 'structure' => $structure, 'uid' => $data['UID']);
if (!empty($_folderId)) {
$messages[$key]['folder_id'] = $_folderId;
}
}
if ($to === null && ctype_digit("{$from}")) {
// only one message requested
return $messages[$from];
} else {
// multiple messages requested
return $messages;
}
}
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:42,代码来源:Imap.php
示例13: decodeRFC822
/**
* Parse an RFC-822 message
*
* this format is quite old and not used anymore but some old
* devices may still send it
*
* @param string $message
* @return array
*/
public static function decodeRFC822(&$message)
{
try {
Zend_Mime_Decode::splitMessage(ltrim($message), $headers, $content);
$contentType = isset($headers['content-type']) ? $headers['content-type'] : '';
if ($contentType) {
$contentType = Zend_Mime_Decode::splitContentType($contentType);
}
if (isset($contentType['boundary'])) {
$mimeParts = self::splitMessageStruct($content, $contentType['boundary']);
} else {
$mimeParts = array();
}
$message = array('headers' => $headers, 'content' => $content, 'mime_parts' => $mimeParts, 'content_type' => $contentType);
return true;
} catch (Exception $e) {
return false;
}
}
开发者ID:jsiefer,项目名称:emarketing,代码行数:28,代码来源:Decode.php
示例14: parseMessage
public function parseMessage($mail, $message, $i)
{
$response = array('message' => array('subject' => null, 'fromEmail' => null, 'message' => null, 'receiveDate' => null), 'attachments' => array());
// Get the UTC timestamp
$timezone = date_default_timezone_get();
date_default_timezone_set('UTC');
$receiveDate = strtotime($message->date);
date_default_timezone_set($timezone);
// Get from
$from = $message->from;
$from = str_replace(array('<', '>'), '', $from);
$from = explode(' ', $from);
$from = array_pop($from);
$response['message']['fromEmail'] = $from;
// Get the message
$messageBody = '';
$boundary = $message->getHeaderField('content-type', 'boundary');
if (stristr($message->contentType, 'text/')) {
$messageBody = $mail->getRawContent($i);
} else {
if (stristr($message->contentType, 'multipart/')) {
$messageParts = new Zend_Mail_Part(array('handler' => &$mail, 'id' => $i, 'headers' => $message->getHeaders()));
// Get the messages's contents. When fetched it removes the
// message
$messageParts->getContent();
foreach ($messageParts as $partIndex => $part) {
$attachment = array('ticketId' => null, 'replyId' => null, 'filename' => null, 'contentType' => null, 'content' => null);
if ($partIndex === 1) {
// Decode attachment's data
$content = (string) $part;
if ($part->headerExists('content-transfer-encoding') and $part->contentTransferEncoding === 'base64') {
$content = base64_decode($content);
}
//-- If an email is set with html + attachment + text alternative, then zend doesn't pickup the sub boundary :(
$sub_boundary = preg_match('([a-zA-Z0-9]{28})', $content, $sub_boundaries);
if ($sub_boundary > 0) {
$subparts = explode('--' . $sub_boundaries[0], $content);
foreach ($subparts as $subpart) {
if (stristr($subpart, 'text/html')) {
$quoted = false;
if (stristr($subpart, 'quoted-printable')) {
$quoted = true;
}
$content = explode("\n\n", $subpart);
array_shift($content);
$content = implode("\n\n", $content);
if ($quoted) {
$content = Zend_Mime_Decode::decodeQuotedPrintable($content);
// Gay ass word wrapping with hmtl is bad idea.
$content = str_replace(array("=\n", '=3D'), array('', '='), $content);
}
}
}
}
$content = nl2br($content);
$messageBody = $content;
} else {
$attachment['contentType'] = $part->contentType;
// Grab the filename
$attachment['filename'] = $part->getHeaderField('content-type', 'name');
// Decode attachment's data
$content = (string) $part;
// TODO: Need to part before assuming it has a transfer encoding
if ($part->contentTransferEncoding === 'base64') {
$content = base64_decode($content);
}
// TODO: other encodings?
$attachment['content'] = $content;
array_push($response['attachments'], $attachment);
}
}
}
}
$response['message']['subject'] = (string) $message->subject;
$response['message']['fromDate'] = (string) $message->from;
$response['message']['message'] = $messageBody;
$response['message']['receiveDate'] = $receiveDate;
return $response;
}
开发者ID:joseph-montanez,项目名称:ZendTickets,代码行数:79,代码来源:TicketController.php
示例15: createFromZMM
/**
* create Tinebase_Mail from Zend_Mail_Message
*
* @param Zend_Mail_Message $_zmm
* @param string $_replyBody
* @return Tinebase_Mail
*/
public static function createFromZMM(Zend_Mail_Message $_zmm, $_replyBody = null)
{
$contentStream = fopen("php://temp", 'r+');
if (preg_match('/application\\/(x\\-){0,1}pkcs7-mime/i', $_zmm->getHeader('content-type')) > 0) {
$mp = new Zend_Mime_Part($_zmm->getContent());
} else {
fputs($contentStream, $_zmm->getContent());
rewind($contentStream);
$mp = new Zend_Mime_Part($contentStream);
}
if ($_zmm->headerExists('content-transfer-encoding')) {
$mp->encoding = $_zmm->getHeader('content-transfer-encoding');
$mp->decodeContent();
} else {
$mp->encoding = Zend_Mime::ENCODING_7BIT;
}
// append old body when no multipart/mixed
if ($_replyBody !== null && $_zmm->headerExists('content-transfer-encoding')) {
$mp = self::_appendReplyBody($mp, $_replyBody);
$mp->encoding = $_zmm->getHeader('content-transfer-encoding');
}
if ($_zmm->headerExists('content-type')) {
$contentTypeHeader = Zend_Mime_Decode::splitHeaderField($_zmm->getHeader('content-type'));
if ($mp->type = strtolower($contentTypeHeader[0]) === 'application/pkcs7-mime') {
$mp->type = $_zmm->getHeader('content-type');
} else {
$mp->type = $contentTypeHeader[0];
}
if (isset($contentTypeHeader['boundary'])) {
$mp->boundary = $contentTypeHeader['boundary'];
}
if (isset($contentTypeHeader['charset'])) {
$mp->charset = $contentTypeHeader['charset'];
}
} else {
$mp->type = Zend_Mime::TYPE_TEXT;
}
$result = new Expressomail_Mail('utf-8');
$result->setBodyText($mp);
foreach ($_zmm->getHeaders() as $header => $values) {
foreach ((array) $values as $value) {
switch ($header) {
case 'content-transfer-encoding':
// these are implicitly set by Zend_Mail_Transport_Abstract::_getHeaders()
// these are implicitly set by Zend_Mail_Transport_Abstract::_getHeaders()
case 'content-type':
case 'mime-version':
// do nothing
break;
case 'bcc':
$addresses = Expressomail_Message::parseAdresslist($value);
foreach ($addresses as $address) {
$result->addBcc($address['address'], $address['name']);
}
break;
case 'cc':
$addresses = Expressomail_Message::parseAdresslist($value);
foreach ($addresses as $address) {
$result->addCc($address['address'], $address['name']);
}
break;
case 'date':
try {
$result->setDate($value);
} catch (Zend_Mail_Exception $zme) {
if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " Could not set date: " . $value);
}
if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " " . $zme);
}
$result->setDate();
}
break;
case 'from':
$addresses = Expressomail_Message::parseAdresslist($value);
foreach ($addresses as $address) {
$result->setFrom($address['address'], $address['name']);
}
break;
case 'message-id':
$result->setMessageId($value);
break;
case 'return-path':
$result->setReturnPath($value);
break;
case 'subject':
$result->setSubject($value);
break;
case 'to':
$addresses = Expressomail_Message::parseAdresslist($value);
foreach ($addresses as $address) {
$result->addTo($address['address'], $address['name']);
//.........这里部分代码省略.........
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:101,代码来源:Mail.php
示例16: getMessageHeaders
/**
* get message headers
*
* @param string|Expressomail_Model_Message $_messageId
* @param boolean $_readOnly
* @return array
* @throws Expressomail_Exception_IMAPMessageNotFound
*/
public function getMessageHeaders($_messageId, $_partId = null, $_readOnly = false)
{
if (!$_messageId instanceof Expressomail_Model_Message) {
$message = $this->_backend->get($_messageId);
} else {
$message = $_messageId;
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Fetching headers for message uid ' . $message->messageuid . ' (part:' . $_partId . ')');
}
try {
$imapBackend = $this->_getBackendAndSelectFolder($message->folder_id);
} catch (Zend_Mail_Storage_Exception $zmse) {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' ' . $zmse->getMessage());
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $zmse->getTraceAsString());
}
throw new Expressomail_Exception_IMAPMessageNotFound('Folder not found');
}
if ($imapBackend === null) {
throw new Expressomail_Exception('Failed to get imap backend');
}
$section = $_partId === null ? 'HEADER' : $_partId . '.HEADER';
try {
$rawHeaders = $imapBackend->getRawContent($message->messageuid, $section, $_readOnly);
if (strtolower(mb_detect_encoding($rawHeaders)) == 'utf-8') {
$rawHeaders = utf8_decode(imap_utf8($rawHeaders));
}
} catch (Expressomail_Exception_IMAPMessageNotFound $feimnf) {
$this->_backend->delete($message->getId());
throw $feimnf;
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Fetched Headers: ' . $rawHeaders);
}
Zend_Mime_Decode::splitMessage($rawHeaders, $headers, $null);
return $headers;
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:48,代码来源:Message.php
示例17: _getMetaDataFromZMM
/**
* get meta data (like contentype, charset, ...) from zmm and set it in zmp
*
* @param Zend_Mail_Message $zmm
* @param Zend_Mime_Part $zmp
*/
protected static function _getMetaDataFromZMM(Zend_Mail_Message $zmm, Zend_Mime_Part $zmp)
{
if ($zmm->headerExists('content-transfer-encoding')) {
$zmp->encoding = $zmm->getHeader('content-transfer-encoding');
} else {
$zmp->encoding = Zend_Mime::ENCODING_7BIT;
}
if ($zmm->headerExists('content-type')) {
$contentTypeHeader = Zend_Mime_Decode::splitHeaderField($zmm->getHeader('content-type'));
$zmp->type = $contentTypeHeader[0];
if (isset($contentTypeHeader['boundary'])) {
$zmp->boundary = $contentTypeHeader['boundary'];
}
if (isset($contentTypeHeader['charset'])) {
$zmp->charset = $contentTypeHeader['charset'];
}
} else {
$zmp->type = Zend_Mime::TYPE_TEXT;
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Encoding: ' . $zmp->encoding . ' / type: ' . $zmp->type . ' / charset: ' . $zmp->charset);
}
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:Mail.php
示例18: getMessageHeaders
/**
* get message headers
*
* @param string|Felamimail_Model_Message $_messageId
* @param boolean $_readOnly
* @return array
* @throws Felamimail_Exception_IMAPMessageNotFound
*/
public function getMessageHeaders($_messageId, $_partId = null, $_readOnly = false)
{
if (!$_messageId instanceof Felamimail_Model_Message) {
$message = $this->_backend->get($_messageId);
} else {
$message = $_messageId;
}
$cache = Tinebase_Core::get('cache');
$cacheId = 'getMessageHeaders' . $message->getId() . str_replace('.', '', $_partId);
if ($cache->test($cacheId)) {
return $cache->load($cacheId);
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Fetching headers for message uid ' . $message->messageuid . ' (part:' . $_partId . ')');
}
try {
$imapBackend = $this->_getBackendAndSelectFolder($message->folder_id);
} catch (Zend_Mail_Storage_Exception $zmse) {
if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . ' ' . $zmse->getMessage());
}
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . $zmse->getTraceAsString());
}
throw new Felamimail_Exception_IMAPMessageNotFound('Folder not found');
}
if ($imapBackend === null) {
throw new Felamimail_Exception('Failed to get imap backend');
}
$section = $_partId === null ? 'HEADER' : $_partId . '.HEADER';
try {
$rawHeaders = $imapBackend->getRawContent($message->messageuid, $section, $_readOnly);
} catch (Felamimail_Exception_IMAPMessageNotFound $feimnf) {
$this->_backend->delete($message->getId());
throw $feimnf;
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Fetched Headers: ' . $rawHeaders);
}
$headers = array();
$body = null;
Zend_Mime_Decode::splitMessage($rawHeaders, $headers, $body);
$cache->save($headers, $cacheId, array('getMessageHeaders'), 86400);
return $headers;
}
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:53,代码来源:Message.php
示例19: testSendAction
/**
* @magentoDataFixture Magento/Wishlist/_files/wishlist.php
*/
public function testSendAction()
{
\Magento\TestFramework\Helper\Bootstrap::getInstance()->loadArea(\Magento\Framework\App\Area::AREA_FRONTEND);
$request = ['form_key' => $this->_objectManager->get('Magento\\Framework\\Data\\Form\\FormKey')->getFormKey(), 'emails' => '[email protected]', 'message' => 'message', 'rss_url' => null];
$this->getRequest()->setPostValue($request);
$this->_objectManager->get('Magento\\Framework\\Registry')->register('wishlist', $this->_objectManager->get('Magento\\Wishlist\\Model\\Wishlist')->loadByCustomerId(1));
$this->dispatch('wishlist/index/send');
/** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */
$transportBuilder = $this->_objectManager->get('Magento\\TestFramework\\Mail\\Template\\TransportBuilderMock');
$actualResult = \Zend_Mime_Decode::decodeQuotedPrintable($transportBuilder->getSentMessage()->getBodyHtml()->getContent());
$this->assertStringMatchesFormat('%A' . $this->_customerViewHelper->getCustomerName($this->_customerSession->getCustomerDataObject()) . ' wants to share this Wish List%A', $actualResult);
}
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:IndexTest.php
示例20: getHeaders
/**
* Get all headers
*
* The returned headers are as saved internally. All names are lowercased. The value is a string or an array
* if a header with the same name occurs more than once.
*
* @return array headers as array(name => value)
*/
public function getHeaders()
{
if ($this->_headers === null) {
if (!$this->_mail) {
$this->_headers = array();
} else {
$part = $this->_mail->getRawHeader($this->_messageNum);
Zend_Mime_Decode::splitMessage($part, $this->_headers, $null);
}
}
return $this->_headers;
}
开发者ID:josephholsten,项目名称:swaplady,代码行数:20,代码来源:Part.php
注:本文中的Zend_Mime_Decode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论