Fixed issue #705

Change-Id: I602a88d24c2a482e6bebb5d6d7f4830843afec42
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ 2016-09-10 22:16:35 +02:00
parent 802c811a70
commit db1a202c5c
42 changed files with 1074 additions and 342 deletions

View File

@ -14,15 +14,15 @@
* *
* @category Zend * @category Zend
* @package Zend * @package Zend
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
/** /**
* @category Zend * @category Zend
* @package Zend * @package Zend
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Exception extends Exception class Zend_Exception extends Exception

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Mail.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -46,7 +46,7 @@ require_once 'Zend/Mime/Part.php';
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail extends Zend_Mime_Message class Zend_Mail extends Zend_Mime_Message
@ -209,7 +209,6 @@ class Zend_Mail extends Zend_Mime_Message
* Public constructor * Public constructor
* *
* @param string $charset * @param string $charset
* @return void
*/ */
public function __construct($charset = null) public function __construct($charset = null)
{ {
@ -329,8 +328,10 @@ class Zend_Mail extends Zend_Mime_Message
/** /**
* Set the encoding of mail headers * Set the encoding of mail headers
* *
* @param string $encoding Zend_Mime::ENCODING_QUOTEDPRINTABLE or Zend_Mime::ENCODING_BASE64 * @param string $encoding Zend_Mime::ENCODING_QUOTEDPRINTABLE or
* Zend_Mime::ENCODING_BASE64
* @return Zend_Mail Provides fluent interface * @return Zend_Mail Provides fluent interface
* @throws Zend_Mail_Exception
*/ */
public function setHeaderEncoding($encoding) public function setHeaderEncoding($encoding)
{ {
@ -378,7 +379,8 @@ class Zend_Mail extends Zend_Mime_Message
/** /**
* Return text body Zend_Mime_Part or string * Return text body Zend_Mime_Part or string
* *
* @param bool textOnly Whether to return just the body text content or the MIME part; defaults to false, the MIME part * @param bool $textOnly Whether to return just the body text content or
* the MIME part; defaults to false, the MIME part
* @return false|Zend_Mime_Part|string * @return false|Zend_Mime_Part|string
*/ */
public function getBodyText($textOnly = false) public function getBodyText($textOnly = false)
@ -562,7 +564,8 @@ class Zend_Mail extends Zend_Mime_Message
} }
/** /**
* Adds To-header and recipient, $email can be an array, or a single string address * Adds To-header and recipient, $email can be an array, or a single string
* address
* *
* @param string|array $email * @param string|array $email
* @param string $name * @param string $name
@ -583,7 +586,8 @@ class Zend_Mail extends Zend_Mime_Message
} }
/** /**
* Adds Cc-header and recipient, $email can be an array, or a single string address * Adds Cc-header and recipient, $email can be an array, or a single string
* address
* *
* @param string|array $email * @param string|array $email
* @param string $name * @param string $name
@ -763,8 +767,8 @@ class Zend_Mail extends Zend_Mime_Message
/** /**
* Sets Default From-email and name of the message * Sets Default From-email and name of the message
* *
* @param string $email * @param string $email
* @param string Optional $name * @param string $name optional
* @return void * @return void
*/ */
public static function setDefaultFrom($email, $name = null) public static function setDefaultFrom($email, $name = null)
@ -796,6 +800,7 @@ class Zend_Mail extends Zend_Mime_Message
* Sets From-name and -email based on the defaults * Sets From-name and -email based on the defaults
* *
* @return Zend_Mail Provides fluent interface * @return Zend_Mail Provides fluent interface
* @throws Zend_Mail_Exception
*/ */
public function setFromToDefaultFrom() { public function setFromToDefaultFrom() {
$from = self::getDefaultFrom(); $from = self::getDefaultFrom();
@ -813,8 +818,8 @@ class Zend_Mail extends Zend_Mime_Message
/** /**
* Sets Default ReplyTo-address and -name of the message * Sets Default ReplyTo-address and -name of the message
* *
* @param string $email * @param string $email
* @param string Optional $name * @param string $name optional
* @return void * @return void
*/ */
public static function setDefaultReplyTo($email, $name = null) public static function setDefaultReplyTo($email, $name = null)
@ -846,6 +851,7 @@ class Zend_Mail extends Zend_Mime_Message
* Sets ReplyTo-name and -email based on the defaults * Sets ReplyTo-name and -email based on the defaults
* *
* @return Zend_Mail Provides fluent interface * @return Zend_Mail Provides fluent interface
* @throws Zend_Mail_Exception
*/ */
public function setReplyToFromDefault() { public function setReplyToFromDefault() {
$replyTo = self::getDefaultReplyTo(); $replyTo = self::getDefaultReplyTo();
@ -961,9 +967,10 @@ class Zend_Mail extends Zend_Mime_Message
/** /**
* Sets Date-header * Sets Date-header
* *
* @param timestamp|string|Zend_Date $date * @param int|string|Zend_Date $date
* @return Zend_Mail Provides fluent interface * @return Zend_Mail Provides fluent interface
* @throws Zend_Mail_Exception if called subsequent times or wrong date format. * @throws Zend_Mail_Exception if called subsequent times or wrong date
* format.
*/ */
public function setDate($date = null) public function setDate($date = null)
{ {
@ -1153,7 +1160,7 @@ class Zend_Mail extends Zend_Mime_Message
/** /**
* Return mail headers * Return mail headers
* *
* @return void * @return array
*/ */
public function getHeaders() public function getHeaders()
{ {
@ -1264,7 +1271,7 @@ class Zend_Mail extends Zend_Mime_Message
return $email; return $email;
} else { } else {
$encodedName = $this->_encodeHeader($name); $encodedName = $this->_encodeHeader($name);
if ($encodedName === $name && strcspn($name, '()<>[]:;@\\,') != strlen($name)) { if ($encodedName === $name && strcspn($name, '()<>[]:;@\\,.') != strlen($name)) {
$format = '"%s" <%s>'; $format = '"%s" <%s>';
} else { } else {
$format = '%s <%s>'; $format = '%s <%s>';

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -29,7 +29,7 @@ require_once 'Zend/Exception.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Exception extends Zend_Exception class Zend_Mail_Exception extends Zend_Exception

View File

@ -0,0 +1,92 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
final class Zend_Mail_Header_HeaderName
{
/**
* No public constructor.
*/
private function __construct()
{
}
/**
* Filter the header name according to RFC 2822
*
* @see http://www.rfc-base.org/txt/rfc-2822.txt (section 2.2)
* @param string $name
* @return string
*/
public static function filter($name)
{
$result = '';
$tot = strlen($name);
for ($i = 0; $i < $tot; $i += 1) {
$ord = ord($name[$i]);
if ($ord > 32 && $ord < 127 && $ord !== 58) {
$result .= $name[$i];
}
}
return $result;
}
/**
* Determine if the header name contains any invalid characters.
*
* @param string $name
* @return bool
*/
public static function isValid($name)
{
$tot = strlen($name);
for ($i = 0; $i < $tot; $i += 1) {
$ord = ord($name[$i]);
if ($ord < 33 || $ord > 126 || $ord === 58) {
return false;
}
}
return true;
}
/**
* Assert that the header name is valid.
*
* Raises an exception if invalid.
*
* @param string $name
* @throws Exception\RuntimeException
* @return void
*/
public static function assertValid($name)
{
if (! self::isValid($name)) {
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Invalid header name detected');
}
}
}

View File

@ -0,0 +1,136 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$
*/
/**
* @category Zend
* @package Zend_Mail
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
final class Zend_Mail_Header_HeaderValue
{
/**
* No public constructor.
*/
private function __construct()
{
}
/**
* Filter the header value according to RFC 2822
*
* @see http://www.rfc-base.org/txt/rfc-2822.txt (section 2.2)
* @param string $value
* @return string
*/
public static function filter($value)
{
$result = '';
$tot = strlen($value);
// Filter for CR and LF characters, leaving CRLF + WSP sequences for
// Long Header Fields (section 2.2.3 of RFC 2822)
for ($i = 0; $i < $tot; $i += 1) {
$ord = ord($value[$i]);
if (($ord < 32 || $ord > 126)
&& $ord !== 13
) {
continue;
}
if ($ord === 13) {
if ($i + 2 >= $tot) {
continue;
}
$lf = ord($value[$i + 1]);
$sp = ord($value[$i + 2]);
if ($lf !== 10 || $sp !== 32) {
continue;
}
$result .= "\r\n ";
$i += 2;
continue;
}
$result .= $value[$i];
}
return $result;
}
/**
* Determine if the header value contains any invalid characters.
*
* @see http://www.rfc-base.org/txt/rfc-2822.txt (section 2.2)
* @param string $value
* @return bool
*/
public static function isValid($value)
{
$tot = strlen($value);
for ($i = 0; $i < $tot; $i += 1) {
$ord = ord($value[$i]);
if (($ord < 32 || $ord > 126)
&& $ord !== 13
) {
return false;
}
if ($ord === 13) {
if ($i + 2 >= $tot) {
return false;
}
$lf = ord($value[$i + 1]);
$sp = ord($value[$i + 2]);
if ($lf !== 10 || $sp !== 32) {
return false;
}
$i += 2;
}
}
return true;
}
/**
* Assert that the header value is valid.
*
* Raises an exception if invalid.
*
* @param string $value
* @throws Exception\RuntimeException
* @return void
*/
public static function assertValid($value)
{
if (! self::isValid($value)) {
require_once 'Zend/Mail/Exception.php';
throw new Zend_Mail_Exception('Invalid header value detected');
}
}
}

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Message.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -33,7 +33,7 @@ require_once 'Zend/Mail/Message/Interface.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Message extends Zend_Mail_Part implements Zend_Mail_Message_Interface class Zend_Mail_Message extends Zend_Mail_Part implements Zend_Mail_Message_Interface
@ -69,6 +69,7 @@ class Zend_Mail_Message extends Zend_Mail_Part implements Zend_Mail_Message_Inte
} else { } else {
$params['raw'] = stream_get_contents($params['file']); $params['raw'] = stream_get_contents($params['file']);
} }
$params['raw'] = preg_replace("/(?<!\r)\n/", "\r\n", $params['raw']);
} }
if (!empty($params['flags'])) { if (!empty($params['flags'])) {

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -33,7 +33,7 @@ require_once 'Zend/Mail/Message/Interface.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Message_File extends Zend_Mail_Part_File implements Zend_Mail_Message_Interface class Zend_Mail_Message_File extends Zend_Mail_Part_File implements Zend_Mail_Message_Interface

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
@ -52,4 +52,4 @@ interface Zend_Mail_Message_Interface
* @return array array with flags, key and value are the same for easy lookup * @return array array with flags, key and value are the same for easy lookup
*/ */
public function getFlags(); public function getFlags();
} }

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Part.php 24759 2012-05-05 02:58:55Z adamlundrigan $ * @version $Id$
*/ */
@ -25,6 +25,16 @@
*/ */
require_once 'Zend/Mime/Decode.php'; require_once 'Zend/Mime/Decode.php';
/**
* @see Zend_Mail_Header_HeaderName
*/
require_once 'Zend/Mail/Header/HeaderName.php';
/**
* @see Zend_Mail_Header_HeaderValue
*/
require_once 'Zend/Mail/Header/HeaderValue.php';
/** /**
* @see Zend_Mail_Part_Interface * @see Zend_Mail_Part_Interface
*/ */
@ -34,7 +44,7 @@ require_once 'Zend/Mail/Part/Interface.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
@ -134,17 +144,19 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
} }
if (isset($params['raw'])) { if (isset($params['raw'])) {
Zend_Mime_Decode::splitMessage($params['raw'], $this->_headers, $this->_content); Zend_Mime_Decode::splitMessage($params['raw'], $this->_headers, $this->_content, "\r\n");
} else if (isset($params['headers'])) { } else if (isset($params['headers'])) {
if (is_array($params['headers'])) { if (is_array($params['headers'])) {
$this->_headers = $params['headers']; $this->_headers = $params['headers'];
$this->_validateHeaders($this->_headers);
} else { } else {
if (!empty($params['noToplines'])) { if (!empty($params['noToplines'])) {
Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $null); Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $null, "\r\n");
} else { } else {
Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $this->_topLines); Zend_Mime_Decode::splitMessage($params['headers'], $this->_headers, $this->_topLines, "\r\n");
} }
} }
if (isset($params['content'])) { if (isset($params['content'])) {
$this->_content = $params['content']; $this->_content = $params['content'];
} }
@ -566,4 +578,26 @@ class Zend_Mail_Part implements RecursiveIterator, Zend_Mail_Part_Interface
$this->countParts(); $this->countParts();
$this->_iterationPos = 1; $this->_iterationPos = 1;
} }
/**
* Ensure headers do not contain invalid characters
*
* @param array $headers
* @param bool $assertNames
*/
protected function _validateHeaders(array $headers, $assertNames = true)
{
foreach ($headers as $name => $value) {
if ($assertNames) {
Zend_Mail_Header_HeaderName::assertValid($name);
}
if (is_array($value)) {
$this->_validateHeaders($value, false);
continue;
}
Zend_Mail_Header_HeaderValue::assertValid($value);
}
}
} }

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: File.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -34,7 +34,7 @@ require_once 'Zend/Mail/Part.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Part_File extends Zend_Mail_Part class Zend_Mail_Part_File extends Zend_Mail_Part

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
@ -133,4 +133,4 @@ interface Zend_Mail_Part_Interface extends RecursiveIterator
* @return string content * @return string content
*/ */
public function __toString(); public function __toString();
} }

View File

@ -16,9 +16,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -42,9 +42,9 @@ require_once 'Zend/Validate/Hostname.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
* @todo Implement proxy settings * @todo Implement proxy settings
*/ */
abstract class Zend_Mail_Protocol_Abstract abstract class Zend_Mail_Protocol_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -31,7 +31,7 @@ require_once 'Zend/Mail/Exception.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Exception extends Zend_Mail_Exception class Zend_Mail_Protocol_Exception extends Zend_Mail_Exception

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Imap.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Imap class Zend_Mail_Protocol_Imap
@ -91,7 +91,17 @@ class Zend_Mail_Protocol_Imap
$errno = 0; $errno = 0;
$errstr = ''; $errstr = '';
$this->_socket = @fsockopen($host, $port, $errno, $errstr, self::TIMEOUT_CONNECTION);
$contextOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false
)
);
$context = stream_context_create($contextOptions);
$this->_socket = stream_socket_client("{$host}:{$port}", $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $context);
if (!$this->_socket) { if (!$this->_socket) {
/** /**
* @see Zend_Mail_Protocol_Exception * @see Zend_Mail_Protocol_Exception

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Pop3.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Pop3 class Zend_Mail_Protocol_Pop3

View File

@ -16,9 +16,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Smtp.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -42,7 +42,7 @@ require_once 'Zend/Mail/Protocol/Abstract.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract class Zend_Mail_Protocol_Smtp extends Zend_Mail_Protocol_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Crammd5.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -33,7 +33,7 @@ require_once 'Zend/Mail/Protocol/Smtp.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Smtp_Auth_Crammd5 extends Zend_Mail_Protocol_Smtp class Zend_Mail_Protocol_Smtp_Auth_Crammd5 extends Zend_Mail_Protocol_Smtp

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Login.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -33,7 +33,7 @@ require_once 'Zend/Mail/Protocol/Smtp.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Smtp_Auth_Login extends Zend_Mail_Protocol_Smtp class Zend_Mail_Protocol_Smtp_Auth_Login extends Zend_Mail_Protocol_Smtp

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Plain.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -33,7 +33,7 @@ require_once 'Zend/Mail/Protocol/Smtp.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Protocol * @subpackage Protocol
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Protocol_Smtp_Auth_Plain extends Zend_Mail_Protocol_Smtp class Zend_Mail_Protocol_Smtp_Auth_Plain extends Zend_Mail_Protocol_Smtp

View File

@ -14,15 +14,15 @@
* *
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Storage.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
/** /**
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage class Zend_Mail_Storage
@ -31,6 +31,7 @@ class Zend_Mail_Storage
// system flags and other flags // system flags and other flags
const FLAG_PASSED = 'Passed'; const FLAG_PASSED = 'Passed';
const FLAG_SEEN = '\Seen'; const FLAG_SEEN = '\Seen';
const FLAG_UNSEEN = '\Unseen';
const FLAG_ANSWERED = '\Answered'; const FLAG_ANSWERED = '\Answered';
const FLAG_FLAGGED = '\Flagged'; const FLAG_FLAGGED = '\Flagged';
const FLAG_DELETED = '\Deleted'; const FLAG_DELETED = '\Deleted';

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, SeekableIterator abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, SeekableIterator
@ -124,8 +124,6 @@ abstract class Zend_Mail_Storage_Abstract implements Countable, ArrayAccess, See
*/ */
abstract public function getMessage($id); abstract public function getMessage($id);
abstract public function getFullMessage($id);
/** /**
* Get raw header of message or part * Get raw header of message or part

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -31,7 +31,7 @@ require_once 'Zend/Mail/Exception.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Exception extends Zend_Mail_Exception class Zend_Mail_Storage_Exception extends Zend_Mail_Exception

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Folder.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Folder implements RecursiveIterator class Zend_Mail_Storage_Folder implements RecursiveIterator

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
interface Zend_Mail_Storage_Folder_Interface interface Zend_Mail_Storage_Folder_Interface

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Maildir.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -41,7 +41,7 @@ require_once 'Zend/Mail/Storage/Maildir.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir implements Zend_Mail_Storage_Folder_Interface class Zend_Mail_Storage_Folder_Maildir extends Zend_Mail_Storage_Maildir implements Zend_Mail_Storage_Folder_Interface

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Mbox.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -41,7 +41,7 @@ require_once 'Zend/Mail/Storage/Mbox.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Zend_Mail_Storage_Folder_Interface class Zend_Mail_Storage_Folder_Mbox extends Zend_Mail_Storage_Mbox implements Zend_Mail_Storage_Folder_Interface

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Imap.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -60,7 +60,7 @@ require_once 'Zend/Mail/Storage.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
@ -88,6 +88,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
protected static $_knownFlags = array('\Passed' => Zend_Mail_Storage::FLAG_PASSED, protected static $_knownFlags = array('\Passed' => Zend_Mail_Storage::FLAG_PASSED,
'\Answered' => Zend_Mail_Storage::FLAG_ANSWERED, '\Answered' => Zend_Mail_Storage::FLAG_ANSWERED,
'\Seen' => Zend_Mail_Storage::FLAG_SEEN, '\Seen' => Zend_Mail_Storage::FLAG_SEEN,
'\Unseen' => Zend_Mail_Storage::FLAG_UNSEEN,
'\Deleted' => Zend_Mail_Storage::FLAG_DELETED, '\Deleted' => Zend_Mail_Storage::FLAG_DELETED,
'\Draft' => Zend_Mail_Storage::FLAG_DRAFT, '\Draft' => Zend_Mail_Storage::FLAG_DRAFT,
'\Flagged' => Zend_Mail_Storage::FLAG_FLAGGED); '\Flagged' => Zend_Mail_Storage::FLAG_FLAGGED);
@ -99,6 +100,7 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
protected static $_searchFlags = array('\Recent' => 'RECENT', protected static $_searchFlags = array('\Recent' => 'RECENT',
'\Answered' => 'ANSWERED', '\Answered' => 'ANSWERED',
'\Seen' => 'SEEN', '\Seen' => 'SEEN',
'\Unseen' => 'UNSEEN',
'\Deleted' => 'DELETED', '\Deleted' => 'DELETED',
'\Draft' => 'DRAFT', '\Draft' => 'DRAFT',
'\Flagged' => 'FLAGGED'); '\Flagged' => 'FLAGGED');
@ -197,13 +199,6 @@ class Zend_Mail_Storage_Imap extends Zend_Mail_Storage_Abstract
return $this->_protocol->fetch('RFC822.HEADER', $id); return $this->_protocol->fetch('RFC822.HEADER', $id);
} }
public function getFullMessage($id)
{
$data = $this->_protocol->fetch(array('RFC822.HEADER', 'RFC822.TEXT'), $id);
return $data['RFC822.HEADER'] . "\n\n" . $data['RFC822.TEXT'];
}
/* /*
* Get raw content of message or part * Get raw content of message or part
* *

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Maildir.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -41,7 +41,7 @@ require_once 'Zend/Mail/Storage.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract class Zend_Mail_Storage_Maildir extends Zend_Mail_Storage_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Mbox.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -42,7 +42,7 @@ require_once 'Zend/Mail/Message/File.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract class Zend_Mail_Storage_Mbox extends Zend_Mail_Storage_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Pop3.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -41,7 +41,7 @@ require_once 'Zend/Mail/Message.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract class Zend_Mail_Storage_Pop3 extends Zend_Mail_Storage_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Interface.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -25,7 +25,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
@ -105,4 +105,4 @@ interface Zend_Mail_Storage_Writable_Interface
* @throws Zend_Mail_Storage_Exception * @throws Zend_Mail_Storage_Exception
*/ */
public function setFlags($id, $flags); public function setFlags($id, $flags);
} }

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Maildir.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -36,7 +36,7 @@ require_once 'Zend/Mail/Storage/Writable/Interface.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Storage * @subpackage Storage
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Maildir class Zend_Mail_Storage_Writable_Maildir extends Zend_Mail_Storage_Folder_Maildir

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -34,7 +34,7 @@ require_once 'Zend/Mime.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
abstract class Zend_Mail_Transport_Abstract abstract class Zend_Mail_Transport_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -31,7 +31,7 @@ require_once 'Zend/Mail/Exception.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Transport_Exception extends Zend_Mail_Exception class Zend_Mail_Transport_Exception extends Zend_Mail_Exception

View File

@ -15,7 +15,7 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id$ * @version $Id$
*/ */
@ -34,7 +34,7 @@ require_once 'Zend/Mail/Transport/Abstract.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Transport_File extends Zend_Mail_Transport_Abstract class Zend_Mail_Transport_File extends Zend_Mail_Transport_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Sendmail.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -33,7 +33,7 @@ require_once 'Zend/Mail/Transport/Abstract.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract class Zend_Mail_Transport_Sendmail extends Zend_Mail_Transport_Abstract

View File

@ -15,9 +15,9 @@
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Smtp.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
@ -45,7 +45,7 @@ require_once 'Zend/Mail/Transport/Abstract.php';
* @category Zend * @category Zend
* @package Zend_Mail * @package Zend_Mail
* @subpackage Transport * @subpackage Transport
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract class Zend_Mail_Transport_Smtp extends Zend_Mail_Transport_Abstract

View File

@ -14,91 +14,389 @@
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Mime.php 24953 2012-06-13 19:09:58Z rob $ * @version $Id$
*/ */
/** /**
* Support class for MultiPart Mime Messages * Support class for MultiPart Mime Messages
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mime class Zend_Mime
{ {
const TYPE_OCTETSTREAM = 'application/octet-stream'; const TYPE_OCTETSTREAM = 'application/octet-stream';
const TYPE_TEXT = 'text/plain'; const TYPE_TEXT = 'text/plain';
const TYPE_HTML = 'text/html'; const TYPE_HTML = 'text/html';
const ENCODING_7BIT = '7bit'; const ENCODING_7BIT = '7bit';
const ENCODING_8BIT = '8bit'; const ENCODING_8BIT = '8bit';
const ENCODING_QUOTEDPRINTABLE = 'quoted-printable'; const ENCODING_QUOTEDPRINTABLE = 'quoted-printable';
const ENCODING_BASE64 = 'base64'; const ENCODING_BASE64 = 'base64';
const DISPOSITION_ATTACHMENT = 'attachment'; const DISPOSITION_ATTACHMENT = 'attachment';
const DISPOSITION_INLINE = 'inline'; const DISPOSITION_INLINE = 'inline';
const LINELENGTH = 72; const LINELENGTH = 72;
const LINEEND = "\n"; const LINEEND = "\n";
const MULTIPART_ALTERNATIVE = 'multipart/alternative'; const MULTIPART_ALTERNATIVE = 'multipart/alternative';
const MULTIPART_MIXED = 'multipart/mixed'; const MULTIPART_MIXED = 'multipart/mixed';
const MULTIPART_RELATED = 'multipart/related'; const MULTIPART_RELATED = 'multipart/related';
/**
* Boundary
*
* @var null|string
*/
protected $_boundary; protected $_boundary;
/**
* @var int
*/
protected static $makeUnique = 0; protected static $makeUnique = 0;
// lookup-Tables for QuotedPrintable /**
* Lookup-Tables for QuotedPrintable
*
* @var array
*/
public static $qpKeys = array( public static $qpKeys = array(
"\x00","\x01","\x02","\x03","\x04","\x05","\x06","\x07", "\x00",
"\x08","\x09","\x0A","\x0B","\x0C","\x0D","\x0E","\x0F", "\x01",
"\x10","\x11","\x12","\x13","\x14","\x15","\x16","\x17", "\x02",
"\x18","\x19","\x1A","\x1B","\x1C","\x1D","\x1E","\x1F", "\x03",
"\x7F","\x80","\x81","\x82","\x83","\x84","\x85","\x86", "\x04",
"\x87","\x88","\x89","\x8A","\x8B","\x8C","\x8D","\x8E", "\x05",
"\x8F","\x90","\x91","\x92","\x93","\x94","\x95","\x96", "\x06",
"\x97","\x98","\x99","\x9A","\x9B","\x9C","\x9D","\x9E", "\x07",
"\x9F","\xA0","\xA1","\xA2","\xA3","\xA4","\xA5","\xA6", "\x08",
"\xA7","\xA8","\xA9","\xAA","\xAB","\xAC","\xAD","\xAE", "\x09",
"\xAF","\xB0","\xB1","\xB2","\xB3","\xB4","\xB5","\xB6", "\x0A",
"\xB7","\xB8","\xB9","\xBA","\xBB","\xBC","\xBD","\xBE", "\x0B",
"\xBF","\xC0","\xC1","\xC2","\xC3","\xC4","\xC5","\xC6", "\x0C",
"\xC7","\xC8","\xC9","\xCA","\xCB","\xCC","\xCD","\xCE", "\x0D",
"\xCF","\xD0","\xD1","\xD2","\xD3","\xD4","\xD5","\xD6", "\x0E",
"\xD7","\xD8","\xD9","\xDA","\xDB","\xDC","\xDD","\xDE", "\x0F",
"\xDF","\xE0","\xE1","\xE2","\xE3","\xE4","\xE5","\xE6", "\x10",
"\xE7","\xE8","\xE9","\xEA","\xEB","\xEC","\xED","\xEE", "\x11",
"\xEF","\xF0","\xF1","\xF2","\xF3","\xF4","\xF5","\xF6", "\x12",
"\xF7","\xF8","\xF9","\xFA","\xFB","\xFC","\xFD","\xFE", "\x13",
"\x14",
"\x15",
"\x16",
"\x17",
"\x18",
"\x19",
"\x1A",
"\x1B",
"\x1C",
"\x1D",
"\x1E",
"\x1F",
"\x7F",
"\x80",
"\x81",
"\x82",
"\x83",
"\x84",
"\x85",
"\x86",
"\x87",
"\x88",
"\x89",
"\x8A",
"\x8B",
"\x8C",
"\x8D",
"\x8E",
"\x8F",
"\x90",
"\x91",
"\x92",
"\x93",
"\x94",
"\x95",
"\x96",
"\x97",
"\x98",
"\x99",
"\x9A",
"\x9B",
"\x9C",
"\x9D",
"\x9E",
"\x9F",
"\xA0",
"\xA1",
"\xA2",
"\xA3",
"\xA4",
"\xA5",
"\xA6",
"\xA7",
"\xA8",
"\xA9",
"\xAA",
"\xAB",
"\xAC",
"\xAD",
"\xAE",
"\xAF",
"\xB0",
"\xB1",
"\xB2",
"\xB3",
"\xB4",
"\xB5",
"\xB6",
"\xB7",
"\xB8",
"\xB9",
"\xBA",
"\xBB",
"\xBC",
"\xBD",
"\xBE",
"\xBF",
"\xC0",
"\xC1",
"\xC2",
"\xC3",
"\xC4",
"\xC5",
"\xC6",
"\xC7",
"\xC8",
"\xC9",
"\xCA",
"\xCB",
"\xCC",
"\xCD",
"\xCE",
"\xCF",
"\xD0",
"\xD1",
"\xD2",
"\xD3",
"\xD4",
"\xD5",
"\xD6",
"\xD7",
"\xD8",
"\xD9",
"\xDA",
"\xDB",
"\xDC",
"\xDD",
"\xDE",
"\xDF",
"\xE0",
"\xE1",
"\xE2",
"\xE3",
"\xE4",
"\xE5",
"\xE6",
"\xE7",
"\xE8",
"\xE9",
"\xEA",
"\xEB",
"\xEC",
"\xED",
"\xEE",
"\xEF",
"\xF0",
"\xF1",
"\xF2",
"\xF3",
"\xF4",
"\xF5",
"\xF6",
"\xF7",
"\xF8",
"\xF9",
"\xFA",
"\xFB",
"\xFC",
"\xFD",
"\xFE",
"\xFF" "\xFF"
); );
/**
* @var array
*/
public static $qpReplaceValues = array( public static $qpReplaceValues = array(
"=00","=01","=02","=03","=04","=05","=06","=07", "=00",
"=08","=09","=0A","=0B","=0C","=0D","=0E","=0F", "=01",
"=10","=11","=12","=13","=14","=15","=16","=17", "=02",
"=18","=19","=1A","=1B","=1C","=1D","=1E","=1F", "=03",
"=7F","=80","=81","=82","=83","=84","=85","=86", "=04",
"=87","=88","=89","=8A","=8B","=8C","=8D","=8E", "=05",
"=8F","=90","=91","=92","=93","=94","=95","=96", "=06",
"=97","=98","=99","=9A","=9B","=9C","=9D","=9E", "=07",
"=9F","=A0","=A1","=A2","=A3","=A4","=A5","=A6", "=08",
"=A7","=A8","=A9","=AA","=AB","=AC","=AD","=AE", "=09",
"=AF","=B0","=B1","=B2","=B3","=B4","=B5","=B6", "=0A",
"=B7","=B8","=B9","=BA","=BB","=BC","=BD","=BE", "=0B",
"=BF","=C0","=C1","=C2","=C3","=C4","=C5","=C6", "=0C",
"=C7","=C8","=C9","=CA","=CB","=CC","=CD","=CE", "=0D",
"=CF","=D0","=D1","=D2","=D3","=D4","=D5","=D6", "=0E",
"=D7","=D8","=D9","=DA","=DB","=DC","=DD","=DE", "=0F",
"=DF","=E0","=E1","=E2","=E3","=E4","=E5","=E6", "=10",
"=E7","=E8","=E9","=EA","=EB","=EC","=ED","=EE", "=11",
"=EF","=F0","=F1","=F2","=F3","=F4","=F5","=F6", "=12",
"=F7","=F8","=F9","=FA","=FB","=FC","=FD","=FE", "=13",
"=14",
"=15",
"=16",
"=17",
"=18",
"=19",
"=1A",
"=1B",
"=1C",
"=1D",
"=1E",
"=1F",
"=7F",
"=80",
"=81",
"=82",
"=83",
"=84",
"=85",
"=86",
"=87",
"=88",
"=89",
"=8A",
"=8B",
"=8C",
"=8D",
"=8E",
"=8F",
"=90",
"=91",
"=92",
"=93",
"=94",
"=95",
"=96",
"=97",
"=98",
"=99",
"=9A",
"=9B",
"=9C",
"=9D",
"=9E",
"=9F",
"=A0",
"=A1",
"=A2",
"=A3",
"=A4",
"=A5",
"=A6",
"=A7",
"=A8",
"=A9",
"=AA",
"=AB",
"=AC",
"=AD",
"=AE",
"=AF",
"=B0",
"=B1",
"=B2",
"=B3",
"=B4",
"=B5",
"=B6",
"=B7",
"=B8",
"=B9",
"=BA",
"=BB",
"=BC",
"=BD",
"=BE",
"=BF",
"=C0",
"=C1",
"=C2",
"=C3",
"=C4",
"=C5",
"=C6",
"=C7",
"=C8",
"=C9",
"=CA",
"=CB",
"=CC",
"=CD",
"=CE",
"=CF",
"=D0",
"=D1",
"=D2",
"=D3",
"=D4",
"=D5",
"=D6",
"=D7",
"=D8",
"=D9",
"=DA",
"=DB",
"=DC",
"=DD",
"=DE",
"=DF",
"=E0",
"=E1",
"=E2",
"=E3",
"=E4",
"=E5",
"=E6",
"=E7",
"=E8",
"=E9",
"=EA",
"=EB",
"=EC",
"=ED",
"=EE",
"=EF",
"=F0",
"=F1",
"=F2",
"=F3",
"=F4",
"=F5",
"=F6",
"=F7",
"=F8",
"=F9",
"=FA",
"=FB",
"=FC",
"=FD",
"=FE",
"=FF" "=FF"
); );
/**
* @var string
*/
public static $qpKeysString = public static $qpKeysString =
"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7F\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8A\x8B\x8C\x8D\x8E\x8F\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9A\x9B\x9C\x9D\x9E\x9F\xA0\xA1\xA2\xA3\xA4\xA5\xA6\xA7\xA8\xA9\xAA\xAB\xAC\xAD\xAE\xAF\xB0\xB1\xB2\xB3\xB4\xB5\xB6\xB7\xB8\xB9\xBA\xBB\xBC\xBD\xBE\xBF\xC0\xC1\xC2\xC3\xC4\xC5\xC6\xC7\xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1\xD2\xD3\xD4\xD5\xD6\xD7\xD8\xD9\xDA\xDB\xDC\xDD\xDE\xDF\xE0\xE1\xE2\xE3\xE4\xE5\xE6\xE7\xE8\xE9\xEA\xEB\xEC\xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF";
/** /**
* Check if the given string is "printable" * Check if the given string is "printable"
@ -117,20 +415,22 @@ class Zend_Mime
/** /**
* Encode a given string with the QUOTED_PRINTABLE mechanism and wrap the lines. * Encode a given string with the QUOTED_PRINTABLE mechanism and wrap the lines.
* *
* @param string $str * @param string $str
* @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineLength Line length; defaults to {@link LINELENGTH}
* @param int $lineEnd Defaults to {@link LINEEND} * @param string $lineEnd Line end; defaults to {@link LINEEND}
* @return string * @return string
*/ */
public static function encodeQuotedPrintable($str, public static function encodeQuotedPrintable(
$str,
$lineLength = self::LINELENGTH, $lineLength = self::LINELENGTH,
$lineEnd = self::LINEEND) $lineEnd = self::LINEEND
)
{ {
$out = ''; $out = '';
$str = self::_encodeQuotedPrintable($str); $str = self::_encodeQuotedPrintable($str);
// Split encoded text into separate lines // Split encoded text into separate lines
while(strlen($str) > 0) { while (strlen($str) > 0) {
$ptr = strlen($str); $ptr = strlen($str);
if ($ptr > $lineLength) { if ($ptr > $lineLength) {
$ptr = $lineLength; $ptr = $lineLength;
@ -154,6 +454,7 @@ class Zend_Mime
$out = rtrim($out, $lineEnd); $out = rtrim($out, $lineEnd);
$out = rtrim($out, '='); $out = rtrim($out, '=');
return $out; return $out;
} }
@ -168,6 +469,7 @@ class Zend_Mime
$str = str_replace('=', '=3D', $str); $str = str_replace('=', '=3D', $str);
$str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str); $str = str_replace(self::$qpKeys, self::$qpReplaceValues, $str);
$str = rtrim($str); $str = rtrim($str);
return $str; return $str;
} }
@ -177,57 +479,60 @@ class Zend_Mime
* Mail headers depend on an extended quoted printable algorithm otherwise * Mail headers depend on an extended quoted printable algorithm otherwise
* a range of bugs can occur. * a range of bugs can occur.
* *
* @param string $str * @param string $str
* @param string $charset * @param string $charset
* @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineLength Line length; defaults to {@link LINELENGTH}
* @param int $lineEnd Defaults to {@link LINEEND} * @param string $lineEnd Line end; defaults to {@link LINEEND}
* @return string * @return string
*/ */
public static function encodeQuotedPrintableHeader($str, $charset, public static function encodeQuotedPrintableHeader(
$lineLength = self::LINELENGTH, $str, $charset, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND
$lineEnd = self::LINEEND) )
{ {
// Reduce line-length by the length of the required delimiter, charsets and encoding // Reduce line-length by the length of the required delimiter, charsets and encoding
$prefix = sprintf('=?%s?Q?', $charset); $prefix = sprintf('=?%s?Q?', $charset);
$lineLength = $lineLength-strlen($prefix)-3; $lineLength = $lineLength - strlen($prefix) - 3;
$str = self::_encodeQuotedPrintable($str); $str = self::_encodeQuotedPrintable($str);
// Mail-Header required chars have to be encoded also: // Mail-Header required chars have to be encoded also:
$str = str_replace(array('?', ' ', '_', ','), array('=3F', '=20', '=5F', '=2C'), $str); $str = str_replace(
array('?', ' ', '_', ','), array('=3F', '=20', '=5F', '=2C'), $str
);
// initialize first line, we need it anyways // initialize first line, we need it anyways
$lines = array(0 => ""); $lines = array(0 => "");
// Split encoded text into separate lines // Split encoded text into separate lines
$tmp = ""; $tmp = "";
while(strlen($str) > 0) { while (strlen($str) > 0) {
$currentLine = max(count($lines)-1, 0); $currentLine = max(count($lines) - 1, 0);
$token = self::getNextQuotedPrintableToken($str); $token = self::getNextQuotedPrintableToken($str);
$str = substr($str, strlen($token)); $str = substr($str, strlen($token));
$tmp .= $token; $tmp .= $token;
if($token == '=20') { if ($token == '=20') {
// only if we have a single char token or space, we can append the // only if we have a single char token or space, we can append the
// tempstring it to the current line or start a new line if necessary. // tempstring it to the current line or start a new line if necessary.
if(strlen($lines[$currentLine].$tmp) > $lineLength) { if (strlen($lines[$currentLine] . $tmp) > $lineLength) {
$lines[$currentLine+1] = $tmp; $lines[$currentLine + 1] = $tmp;
} else { } else {
$lines[$currentLine] .= $tmp; $lines[$currentLine] .= $tmp;
} }
$tmp = ""; $tmp = "";
} }
// don't forget to append the rest to the last line // don't forget to append the rest to the last line
if(strlen($str) == 0) { if (strlen($str) == 0) {
$lines[$currentLine] .= $tmp; $lines[$currentLine] .= $tmp;
} }
} }
// assemble the lines together by pre- and appending delimiters, charset, encoding. // assemble the lines together by pre- and appending delimiters, charset, encoding.
for($i = 0; $i < count($lines); $i++) { for ($i = 0; $i < count($lines); $i++) {
$lines[$i] = " ".$prefix.$lines[$i]."?="; $lines[$i] = " " . $prefix . $lines[$i] . "?=";
} }
$str = trim(implode($lineEnd, $lines)); $str = trim(implode($lineEnd, $lines));
return $str; return $str;
} }
@ -239,35 +544,38 @@ class Zend_Mime
*/ */
private static function getNextQuotedPrintableToken($str) private static function getNextQuotedPrintableToken($str)
{ {
if(substr($str, 0, 1) == "=") { if (substr($str, 0, 1) == "=") {
$token = substr($str, 0, 3); $token = substr($str, 0, 3);
} else { } else {
$token = substr($str, 0, 1); $token = substr($str, 0, 1);
} }
return $token; return $token;
} }
/** /**
* Encode a given string in mail header compatible base64 encoding. * Encode a given string in mail header compatible base64 encoding.
* *
* @param string $str * @param string $str
* @param string $charset * @param string $charset
* @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineLength Line length; defaults to {@link LINELENGTH}
* @param int $lineEnd Defaults to {@link LINEEND} * @param string $lineEnd Line end; defaults to {@link LINEEND}
* @return string * @return string
*/ */
public static function encodeBase64Header($str, public static function encodeBase64Header(
$charset, $str, $charset, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND
$lineLength = self::LINELENGTH, )
$lineEnd = self::LINEEND)
{ {
$prefix = '=?' . $charset . '?B?'; $prefix = '=?' . $charset . '?B?';
$suffix = '?='; $suffix = '?=';
$remainingLength = $lineLength - strlen($prefix) - strlen($suffix); $remainingLength = $lineLength - strlen($prefix) - strlen($suffix);
$encodedValue = self::encodeBase64($str, $remainingLength, $lineEnd); $encodedValue = self::encodeBase64($str, $remainingLength, $lineEnd);
$encodedValue = str_replace($lineEnd, $suffix . $lineEnd . ' ' . $prefix, $encodedValue); $encodedValue = str_replace(
$lineEnd, $suffix . $lineEnd . ' ' . $prefix, $encodedValue
);
$encodedValue = $prefix . $encodedValue . $suffix; $encodedValue = $prefix . $encodedValue . $suffix;
return $encodedValue; return $encodedValue;
} }
@ -275,14 +583,14 @@ class Zend_Mime
* Encode a given string in base64 encoding and break lines * Encode a given string in base64 encoding and break lines
* according to the maximum linelength. * according to the maximum linelength.
* *
* @param string $str * @param string $str
* @param int $lineLength Defaults to {@link LINELENGTH} * @param int $lineLength Line length; defaults to {@link LINELENGTH}
* @param int $lineEnd Defaults to {@link LINEEND} * @param string $lineEnd Line end; defaults to {@link LINEEND}
* @return string * @return string
*/ */
public static function encodeBase64($str, public static function encodeBase64(
$lineLength = self::LINELENGTH, $str, $lineLength = self::LINELENGTH, $lineEnd = self::LINEEND
$lineEnd = self::LINEEND) )
{ {
return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd)); return rtrim(chunk_split(base64_encode($str), $lineLength, $lineEnd));
} }
@ -291,8 +599,6 @@ class Zend_Mime
* Constructor * Constructor
* *
* @param null|string $boundary * @param null|string $boundary
* @access public
* @return void
*/ */
public function __construct($boundary = null) public function __construct($boundary = null)
{ {
@ -309,7 +615,7 @@ class Zend_Mime
* *
* @param string $str * @param string $str
* @param string $encoding * @param string $encoding
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
* @return string * @return string
*/ */
public static function encode($str, $encoding, $EOL = self::LINEEND) public static function encode($str, $encoding, $EOL = self::LINEEND)
@ -343,8 +649,7 @@ class Zend_Mime
/** /**
* Return a MIME boundary line * Return a MIME boundary line
* *
* @param mixed $EOL Defaults to {@link LINEEND} * @param string $EOL Line end; defaults to {@link LINEEND}
* @access public
* @return string * @return string
*/ */
public function boundaryLine($EOL = self::LINEEND) public function boundaryLine($EOL = self::LINEEND)
@ -355,7 +660,7 @@ class Zend_Mime
/** /**
* Return MIME ending * Return MIME ending
* *
* @access public * @param string $EOL Line end; defaults to {@link LINEEND}
* @return string * @return string
*/ */
public function mimeEnd($EOL = self::LINEEND) public function mimeEnd($EOL = self::LINEEND)

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Decode.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
/** /**
@ -27,7 +27,7 @@ require_once 'Zend/Mime.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mime_Decode class Zend_Mime_Decode
@ -48,7 +48,7 @@ class Zend_Mime_Decode
$body = str_replace("\r", '', $body); $body = str_replace("\r", '', $body);
$start = 0; $start = 0;
$res = array(); $res = array();
// find every mime part limiter and cut out the // find every mime part limiter and cut out the
// string before it. // string before it.
// the part before the first boundary string is discarded: // the part before the first boundary string is discarded:
@ -68,12 +68,13 @@ class Zend_Mime_Decode
// no more parts, find end boundary // no more parts, find end boundary
$p = strpos($body, '--' . $boundary . '--', $start); $p = strpos($body, '--' . $boundary . '--', $start);
if ($p===false) { if ($p === false) {
throw new Zend_Exception('Not a valid Mime Message: End Missing'); throw new Zend_Exception('Not a valid Mime Message: End Missing');
} }
// the remaining part also needs to be parsed: // the remaining part also needs to be parsed:
$res[] = substr($body, $start, $p-$start); $res[] = substr($body, $start, $p - $start);
return $res; return $res;
} }
@ -83,11 +84,13 @@ class Zend_Mime_Decode
* *
* @param string $message raw message content * @param string $message raw message content
* @param string $boundary boundary as found in content-type * @param string $boundary boundary as found in content-type
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
* @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found * @return array|null parts as array('header' => array(name => value), 'body' => content), null if no parts found
* @throws Zend_Exception * @throws Zend_Exception
*/ */
public static function splitMessageStruct($message, $boundary, $EOL = Zend_Mime::LINEEND) public static function splitMessageStruct(
$message, $boundary, $EOL = Zend_Mime::LINEEND
)
{ {
$parts = self::splitMime($message, $boundary); $parts = self::splitMime($message, $boundary);
if (count($parts) <= 0) { if (count($parts) <= 0) {
@ -96,9 +99,12 @@ class Zend_Mime_Decode
$result = array(); $result = array();
foreach ($parts as $part) { foreach ($parts as $part) {
self::splitMessage($part, $headers, $body, $EOL); self::splitMessage($part, $headers, $body, $EOL);
$result[] = array('header' => $headers, $result[] = array(
'body' => $body ); 'header' => $headers,
'body' => $body
);
} }
return $result; return $result;
} }
@ -111,17 +117,28 @@ class Zend_Mime_Decode
* @param string $message raw message with header and optional content * @param string $message raw message with header and optional content
* @param array $headers output param, array with headers as array(name => value) * @param array $headers output param, array with headers as array(name => value)
* @param string $body output param, content of message * @param string $body output param, content of message
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
* @return null * @return null
*/ */
public static function splitMessage($message, &$headers, &$body, $EOL = Zend_Mime::LINEEND) public static function splitMessage(
$message, &$headers, &$body, $EOL = Zend_Mime::LINEEND
)
{ {
// check for valid header at first line // check for valid header at first line
$firstline = strtok($message, "\n"); $firstline = strtok($message, "\n");
if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) { if (!preg_match('%^[^\s]+[^:]*:%', $firstline)) {
$headers = array(); $headers = array();
// TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r? // TODO: we're ignoring \r for now - is this function fast enough and is it safe to asume noone needs \r?
$body = str_replace(array("\r", "\n"), array('', $EOL), $message); $body = str_replace(
array(
"\r",
"\n"
), array(
'',
$EOL
), $message
);
return; return;
} }
@ -129,20 +146,27 @@ class Zend_Mime_Decode
// default is set new line // default is set new line
if (strpos($message, $EOL . $EOL)) { if (strpos($message, $EOL . $EOL)) {
list($headers, $body) = explode($EOL . $EOL, $message, 2); list($headers, $body) = explode($EOL . $EOL, $message, 2);
// next is the standard new line // next is the standard new line
} else if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
list($headers, $body) = explode("\r\n\r\n", $message, 2);
// next is the other "standard" new line
} else if ($EOL != "\n" && strpos($message, "\n\n")) {
list($headers, $body) = explode("\n\n", $message, 2);
// at last resort find anything that looks like a new line
} else { } else {
@list($headers, $body) = @preg_split("%([\r\n]+)\\1%U", $message, 2); if ($EOL != "\r\n" && strpos($message, "\r\n\r\n")) {
list($headers, $body) = explode("\r\n\r\n", $message, 2);
// next is the other "standard" new line
} else {
if ($EOL != "\n" && strpos($message, "\n\n")) {
list($headers, $body) = explode("\n\n", $message, 2);
// at last resort find anything that looks like a new line
} else {
@list($headers, $body) =
@preg_split("%([\r\n]+)\\1%U", $message, 2);
}
}
} }
$headers = iconv_mime_decode_headers($headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR); $headers = iconv_mime_decode_headers(
$headers, ICONV_MIME_DECODE_CONTINUE_ON_ERROR
);
if ($headers === false ) { if ($headers === false) {
// an error occurs during the decoding // an error occurs during the decoding
return; return;
} }
@ -162,7 +186,10 @@ class Zend_Mime_Decode
$headers[$lower][] = $header; $headers[$lower][] = $header;
continue; continue;
} }
$headers[$lower] = array($headers[$lower], $header); $headers[$lower] = array(
$headers[$lower],
$header
);
} }
} }
@ -181,20 +208,23 @@ class Zend_Mime_Decode
/** /**
* split a header field like content type in its different parts * split a header field like content type in its different parts
* *
* @param string $type header field * @param string $field
* @param string $wantedPart the wanted part, else an array with all parts is returned * @param string $wantedPart the wanted part, else an array with all parts is returned
* @param string $firstName key name for the first part * @param int|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 * @throws Zend_Exception
* @return string|array wanted part or all parts as array($firstName => firstPart, partname => value)
*/ */
public static function splitHeaderField($field, $wantedPart = null, $firstName = 0) public static function splitHeaderField(
$field, $wantedPart = null, $firstName = 0
)
{ {
$wantedPart = strtolower($wantedPart); $wantedPart = strtolower($wantedPart);
$firstName = strtolower($firstName); $firstName = strtolower($firstName);
// special case - a bit optimized // special case - a bit optimized
if ($firstName === $wantedPart) { if ($firstName === $wantedPart) {
$field = strtok($field, ';'); $field = strtok($field, ';');
return $field[0] == '"' ? substr($field, 1, -1) : $field; return $field[0] == '"' ? substr($field, 1, -1) : $field;
} }
@ -211,8 +241,10 @@ class Zend_Mime_Decode
if ($matches[2][$key][0] != '"') { if ($matches[2][$key][0] != '"') {
return $matches[2][$key]; return $matches[2][$key];
} }
return substr($matches[2][$key], 1, -1); return substr($matches[2][$key], 1, -1);
} }
return null; return null;
} }
@ -234,8 +266,8 @@ class Zend_Mime_Decode
* *
* The charset of the returned string depends on your iconv settings. * The charset of the returned string depends on your iconv settings.
* *
* @param string encoded string * @param string $string Encoded string
* @return string decoded string * @return string Decoded string
*/ */
public static function decodeQuotedPrintable($string) public static function decodeQuotedPrintable($string)
{ {

View File

@ -14,24 +14,23 @@
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
/** /**
* Zend_Exception * Zend_Exception
*/ */
require_once 'Zend/Exception.php'; require_once 'Zend/Exception.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mime_Exception extends Zend_Exception class Zend_Mime_Exception extends Zend_Exception
{} {
}

View File

@ -14,12 +14,11 @@
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Message.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
/** /**
* Zend_Mime * Zend_Mime
*/ */
@ -30,17 +29,26 @@ require_once 'Zend/Mime.php';
*/ */
require_once 'Zend/Mime/Part.php'; require_once 'Zend/Mime/Part.php';
/** /**
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mime_Message class Zend_Mime_Message
{ {
/**
* The Zend_Mime_Parts of the message
*
* @var array
*/
protected $_parts = array(); protected $_parts = array();
/**
* The Zend_Mime object for the message
*
* @var Zend_Mime|null
*/
protected $_mime = null; protected $_mime = null;
/** /**
@ -134,7 +142,7 @@ class Zend_Mime_Message
*/ */
public function generateMessage($EOL = Zend_Mime::LINEEND) public function generateMessage($EOL = Zend_Mime::LINEEND)
{ {
if (! $this->isMultiPart()) { if (!$this->isMultiPart()) {
$body = array_shift($this->_parts); $body = array_shift($this->_parts);
$body = $body->getContent($EOL); $body = $body->getContent($EOL);
} else { } else {
@ -146,9 +154,9 @@ class Zend_Mime_Message
foreach (array_keys($this->_parts) as $p) { foreach (array_keys($this->_parts) as $p) {
$body .= $boundaryLine $body .= $boundaryLine
. $this->getPartHeaders($p, $EOL) . $this->getPartHeaders($p, $EOL)
. $EOL . $EOL
. $this->getPartContent($p, $EOL); . $this->getPartContent($p, $EOL);
} }
$body .= $mime->mimeEnd($EOL); $body .= $mime->mimeEnd($EOL);
@ -171,7 +179,8 @@ class Zend_Mime_Message
/** /**
* Get the headers of a given part as a string * Get the headers of a given part as a string
* *
* @param int $partnum * @param int $partnum
* @param string $EOL
* @return string * @return string
*/ */
public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND) public function getPartHeaders($partnum, $EOL = Zend_Mime::LINEEND)
@ -182,7 +191,8 @@ class Zend_Mime_Message
/** /**
* Get the (encoded) content of a given part as a string * Get the (encoded) content of a given part as a string
* *
* @param int $partnum * @param int $partnum
* @param string $EOL
* @return string * @return string
*/ */
public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND) public function getPartContent($partnum, $EOL = Zend_Mime::LINEEND)
@ -195,18 +205,19 @@ class Zend_Mime_Message
* *
* Parts consist of the header and the body of each MIME part. * Parts consist of the header and the body of each MIME part.
* *
* @param string $body * @param string $body
* @param string $boundary * @param string $boundary
* @throws Zend_Exception
* @return array * @return array
*/ */
protected static function _disassembleMime($body, $boundary) protected static function _disassembleMime($body, $boundary)
{ {
$start = 0; $start = 0;
$res = array(); $res = array();
// find every mime part limiter and cut out the // find every mime part limiter and cut out the
// string before it. // string before it.
// the part before the first boundary string is discarded: // the part before the first boundary string is discarded:
$p = strpos($body, '--'.$boundary."\n", $start); $p = strpos($body, '--' . $boundary . "\n", $start);
if ($p === false) { if ($p === false) {
// no parts found! // no parts found!
return array(); return array();
@ -215,19 +226,21 @@ class Zend_Mime_Message
// position after first boundary line // position after first boundary line
$start = $p + 3 + strlen($boundary); $start = $p + 3 + strlen($boundary);
while (($p = strpos($body, '--' . $boundary . "\n", $start)) !== false) { while (($p = strpos($body, '--' . $boundary . "\n", $start))
$res[] = substr($body, $start, $p-$start); !== false) {
$res[] = substr($body, $start, $p - $start);
$start = $p + 3 + strlen($boundary); $start = $p + 3 + strlen($boundary);
} }
// no more parts, find end boundary // no more parts, find end boundary
$p = strpos($body, '--' . $boundary . '--', $start); $p = strpos($body, '--' . $boundary . '--', $start);
if ($p===false) { if ($p === false) {
throw new Zend_Exception('Not a valid Mime Message: End Missing'); throw new Zend_Exception('Not a valid Mime Message: End Missing');
} }
// the remaining part also needs to be parsed: // the remaining part also needs to be parsed:
$res[] = substr($body, $start, $p-$start); $res[] = substr($body, $start, $p - $start);
return $res; return $res;
} }
@ -235,12 +248,15 @@ class Zend_Mime_Message
* Decodes a MIME encoded string and returns a Zend_Mime_Message object with * Decodes a MIME encoded string and returns a Zend_Mime_Message object with
* all the MIME parts set according to the given string * all the MIME parts set according to the given string
* *
* @param string $message * @param string $message
* @param string $boundary * @param string $boundary
* @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND} * @param string $EOL EOL string; defaults to {@link Zend_Mime::LINEEND}
* @throws Zend_Exception
* @return Zend_Mime_Message * @return Zend_Mime_Message
*/ */
public static function createFromMessage($message, $boundary, $EOL = Zend_Mime::LINEEND) public static function createFromMessage(
$message, $boundary, $EOL = Zend_Mime::LINEEND
)
{ {
require_once 'Zend/Mime/Decode.php'; require_once 'Zend/Mime/Decode.php';
$parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL); $parts = Zend_Mime_Decode::splitMessageStruct($message, $boundary, $EOL);
@ -253,7 +269,7 @@ class Zend_Mime_Message
/** /**
* @todo check for characterset and filename * @todo check for characterset and filename
*/ */
switch(strtolower($key)) { switch (strtolower($key)) {
case 'content-type': case 'content-type':
$newPart->type = $value; $newPart->type = $value;
break; break;
@ -261,7 +277,7 @@ class Zend_Mime_Message
$newPart->encoding = $value; $newPart->encoding = $value;
break; break;
case 'content-id': case 'content-id':
$newPart->id = trim($value,'<>'); $newPart->id = trim($value, '<>');
break; break;
case 'content-disposition': case 'content-disposition':
$newPart->disposition = $value; $newPart->disposition = $value;
@ -276,11 +292,14 @@ class Zend_Mime_Message
$newPart->language = $value; $newPart->language = $value;
break; break;
default: default:
throw new Zend_Exception('Unknown header ignored for MimePart:' . $key); throw new Zend_Exception(
'Unknown header ignored for MimePart:' . $key
);
} }
} }
$res->addPart($newPart); $res->addPart($newPart);
} }
return $res; return $res;
} }
} }

View File

@ -14,9 +14,9 @@
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Part.php 24593 2012-01-05 20:35:02Z matthew $ * @version $Id$
*/ */
/** /**
@ -29,31 +29,100 @@ require_once 'Zend/Mime.php';
* *
* @category Zend * @category Zend
* @package Zend_Mime * @package Zend_Mime
* @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License * @license http://framework.zend.com/license/new-bsd New BSD License
*/ */
class Zend_Mime_Part { class Zend_Mime_Part
{
/**
* Type
*
* @var string
*/
public $type = Zend_Mime::TYPE_OCTETSTREAM; public $type = Zend_Mime::TYPE_OCTETSTREAM;
public $encoding = Zend_Mime::ENCODING_8BIT;
public $id;
public $disposition;
public $filename;
public $description;
public $charset;
public $boundary;
public $location;
public $language;
protected $_content;
protected $_isStream = false;
/**
* Encoding
*
* @var string
*/
public $encoding = Zend_Mime::ENCODING_8BIT;
/**
* ID
*
* @var string
*/
public $id;
/**
* Disposition
*
* @var string
*/
public $disposition;
/**
* Filename
*
* @var string
*/
public $filename;
/**
* Description
*
* @var string
*/
public $description;
/**
* Character set
*
* @var string
*/
public $charset;
/**
* Boundary
*
* @var string
*/
public $boundary;
/**
* Location
*
* @var string
*/
public $location;
/**
* Language
*
* @var string
*/
public $language;
/**
* Content
*
* @var mixed
*/
protected $_content;
/**
* @var bool
*/
protected $_isStream = false;
/** /**
* create a new Mime Part. * create a new Mime Part.
* The (unencoded) content of the Part as passed * The (unencoded) content of the Part as passed
* as a string or stream * as a string or stream
* *
* @param mixed $content String or Stream containing the content * @param mixed $content String or Stream containing the content
*/ */
public function __construct($content) public function __construct($content)
{ {
@ -79,21 +148,23 @@ class Zend_Mime_Part {
*/ */
public function isStream() public function isStream()
{ {
return $this->_isStream; return $this->_isStream;
} }
/** /**
* if this was created with a stream, return a filtered stream for * if this was created with a stream, return a filtered stream for
* reading the content. very useful for large file attachments. * reading the content. very useful for large file attachments.
* *
* @return stream * @return mixed Stream
* @throws Zend_Mime_Exception if not a stream or unable to append filter * @throws Zend_Mime_Exception if not a stream or unable to append filter
*/ */
public function getEncodedStream() public function getEncodedStream()
{ {
if (!$this->_isStream) { if (!$this->_isStream) {
require_once 'Zend/Mime/Exception.php'; require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Attempt to get a stream from a string part'); throw new Zend_Mime_Exception(
'Attempt to get a stream from a string part'
);
} }
//stream_filter_remove(); // ??? is that right? //stream_filter_remove(); // ??? is that right?
@ -110,9 +181,12 @@ class Zend_Mime_Part {
); );
if (!is_resource($filter)) { if (!is_resource($filter)) {
require_once 'Zend/Mime/Exception.php'; require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append quoted-printable filter'); throw new Zend_Mime_Exception(
'Failed to append quoted-printable filter'
);
} }
break; break;
case Zend_Mime::ENCODING_BASE64: case Zend_Mime::ENCODING_BASE64:
$filter = stream_filter_append( $filter = stream_filter_append(
$this->_content, $this->_content,
@ -125,18 +199,24 @@ class Zend_Mime_Part {
); );
if (!is_resource($filter)) { if (!is_resource($filter)) {
require_once 'Zend/Mime/Exception.php'; require_once 'Zend/Mime/Exception.php';
throw new Zend_Mime_Exception('Failed to append base64 filter'); throw new Zend_Mime_Exception(
'Failed to append base64 filter'
);
} }
break; break;
default: default:
} }
return $this->_content; return $this->_content;
} }
/** /**
* Get the Content of the current Mime Part in the given encoding. * Get the Content of the current Mime Part in the given encoding.
* *
* @return String * @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
* @throws Zend_Mime_Exception
* @return string
*/ */
public function getContent($EOL = Zend_Mime::LINEEND) public function getContent($EOL = Zend_Mime::LINEEND)
{ {
@ -146,9 +226,10 @@ class Zend_Mime_Part {
return Zend_Mime::encode($this->_content, $this->encoding, $EOL); return Zend_Mime::encode($this->_content, $this->encoding, $EOL);
} }
} }
/** /**
* Get the RAW unencoded content from this part * Get the RAW unencoded content from this part
*
* @return string * @return string
*/ */
public function getRawContent() public function getRawContent()
@ -163,7 +244,7 @@ class Zend_Mime_Part {
/** /**
* Create and return the array of headers for this MIME part * Create and return the array of headers for this MIME part
* *
* @access public * @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
* @return array * @return array
*/ */
public function getHeadersArray($EOL = Zend_Mime::LINEEND) public function getHeadersArray($EOL = Zend_Mime::LINEEND)
@ -177,17 +258,26 @@ class Zend_Mime_Part {
if ($this->boundary) { if ($this->boundary) {
$contentType .= ';' . $EOL $contentType .= ';' . $EOL
. " boundary=\"" . $this->boundary . '"'; . " boundary=\"" . $this->boundary . '"';
} }
$headers[] = array('Content-Type', $contentType); $headers[] = array(
'Content-Type',
$contentType
);
if ($this->encoding) { if ($this->encoding) {
$headers[] = array('Content-Transfer-Encoding', $this->encoding); $headers[] = array(
'Content-Transfer-Encoding',
$this->encoding
);
} }
if ($this->id) { if ($this->id) {
$headers[] = array('Content-ID', '<' . $this->id . '>'); $headers[] = array(
'Content-ID',
'<' . $this->id . '>'
);
} }
if ($this->disposition) { if ($this->disposition) {
@ -195,19 +285,31 @@ class Zend_Mime_Part {
if ($this->filename) { if ($this->filename) {
$disposition .= '; filename="' . $this->filename . '"'; $disposition .= '; filename="' . $this->filename . '"';
} }
$headers[] = array('Content-Disposition', $disposition); $headers[] = array(
'Content-Disposition',
$disposition
);
} }
if ($this->description) { if ($this->description) {
$headers[] = array('Content-Description', $this->description); $headers[] = array(
'Content-Description',
$this->description
);
} }
if ($this->location) { if ($this->location) {
$headers[] = array('Content-Location', $this->location); $headers[] = array(
'Content-Location',
$this->location
);
} }
if ($this->language){ if ($this->language) {
$headers[] = array('Content-Language', $this->language); $headers[] = array(
'Content-Language',
$this->language
);
} }
return $headers; return $headers;
@ -216,7 +318,8 @@ class Zend_Mime_Part {
/** /**
* Return the headers for this part as a string * Return the headers for this part as a string
* *
* @return String * @param string $EOL Line end; defaults to {@link Zend_Mime::LINEEND}
* @return string
*/ */
public function getHeaders($EOL = Zend_Mime::LINEEND) public function getHeaders($EOL = Zend_Mime::LINEEND)
{ {