diff --git a/src/Address.php b/src/Address.php index 7a30f4e7..385b9d86 100644 --- a/src/Address.php +++ b/src/Address.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail; -/** - * @category Zend - * @package Zend_Mail - */ class Address implements Address\AddressInterface { protected $email; diff --git a/src/Address/AddressInterface.php b/src/Address/AddressInterface.php index 9b275211..2b88b81c 100644 --- a/src/Address/AddressInterface.php +++ b/src/Address/AddressInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Address; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Address - */ interface AddressInterface { public function getEmail(); diff --git a/src/AddressList.php b/src/AddressList.php index 8c6fea3e..8aab186a 100644 --- a/src/AddressList.php +++ b/src/AddressList.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail; @@ -13,10 +12,6 @@ use Countable; use Iterator; -/** - * @category Zend - * @package Zend_Mail - */ class AddressList implements Countable, Iterator { /** diff --git a/src/Exception/BadMethodCallException.php b/src/Exception/BadMethodCallException.php index 362eb222..3c379c8c 100644 --- a/src/Exception/BadMethodCallException.php +++ b/src/Exception/BadMethodCallException.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Exception; /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface diff --git a/src/Exception/DomainException.php b/src/Exception/DomainException.php index e0005f31..c723d86f 100644 --- a/src/Exception/DomainException.php +++ b/src/Exception/DomainException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class DomainException extends \DomainException implements ExceptionInterface { diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php index e7b93001..088232fa 100644 --- a/src/Exception/ExceptionInterface.php +++ b/src/Exception/ExceptionInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Exception; -/** - * @category Zend - * @package Zend_Mail - */ interface ExceptionInterface { } diff --git a/src/Exception/InvalidArgumentException.php b/src/Exception/InvalidArgumentException.php index 650b1234..6b29a92f 100644 --- a/src/Exception/InvalidArgumentException.php +++ b/src/Exception/InvalidArgumentException.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Exception; /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface diff --git a/src/Exception/OutOfBoundsException.php b/src/Exception/OutOfBoundsException.php index ad494ab5..86afef29 100644 --- a/src/Exception/OutOfBoundsException.php +++ b/src/Exception/OutOfBoundsException.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Exception; /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface { diff --git a/src/Exception/RuntimeException.php b/src/Exception/RuntimeException.php index acb8835e..d8120093 100644 --- a/src/Exception/RuntimeException.php +++ b/src/Exception/RuntimeException.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Exception; /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class RuntimeException extends \RuntimeException implements ExceptionInterface { diff --git a/src/Header/AbstractAddressList.php b/src/Header/AbstractAddressList.php index 36edbc9b..97cbd5f1 100644 --- a/src/Header/AbstractAddressList.php +++ b/src/Header/AbstractAddressList.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; @@ -15,10 +14,6 @@ /** * Base class for headers composing address lists (to, from, cc, bcc, reply-to) - * - * @category Zend - * @package Zend_Mail - * @subpackage Header */ abstract class AbstractAddressList implements HeaderInterface { diff --git a/src/Header/Bcc.php b/src/Header/Bcc.php index f3f99c6a..53f8a746 100644 --- a/src/Header/Bcc.php +++ b/src/Header/Bcc.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class Bcc extends AbstractAddressList { protected $fieldName = 'Bcc'; diff --git a/src/Header/Cc.php b/src/Header/Cc.php index 99deb9ba..af35edc6 100644 --- a/src/Header/Cc.php +++ b/src/Header/Cc.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class Cc extends AbstractAddressList { protected $fieldName = 'Cc'; diff --git a/src/Header/ContentType.php b/src/Header/ContentType.php index 678a4a5d..9ae46b32 100644 --- a/src/Header/ContentType.php +++ b/src/Header/ContentType.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; use Zend\Mail\Headers; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class ContentType implements HeaderInterface { /** diff --git a/src/Header/Date.php b/src/Header/Date.php index c75ab8ce..ff7604e2 100644 --- a/src/Header/Date.php +++ b/src/Header/Date.php @@ -5,16 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; /** * @todo Add accessors for setting date from DateTime, Zend\Date, or a string - * @category Zend - * @package Zend_Mail - * @subpackage Header */ class Date implements HeaderInterface { diff --git a/src/Header/Exception/BadMethodCallException.php b/src/Header/Exception/BadMethodCallException.php index 7de8622a..ee9160a0 100644 --- a/src/Header/Exception/BadMethodCallException.php +++ b/src/Header/Exception/BadMethodCallException.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header\Exception; use Zend\Mail\Exception; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class BadMethodCallException extends Exception\BadMethodCallException implements ExceptionInterface { diff --git a/src/Header/Exception/ExceptionInterface.php b/src/Header/Exception/ExceptionInterface.php index e0db0836..46751bd5 100644 --- a/src/Header/Exception/ExceptionInterface.php +++ b/src/Header/Exception/ExceptionInterface.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header\Exception; use Zend\Mail\Exception\ExceptionInterface as MailException; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ interface ExceptionInterface extends MailException { } diff --git a/src/Header/Exception/InvalidArgumentException.php b/src/Header/Exception/InvalidArgumentException.php index 014bc29c..5cf3345c 100644 --- a/src/Header/Exception/InvalidArgumentException.php +++ b/src/Header/Exception/InvalidArgumentException.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header\Exception; use Zend\Mail\Exception; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface {} diff --git a/src/Header/Exception/RuntimeException.php b/src/Header/Exception/RuntimeException.php index 0d8c59ea..5c9316c9 100644 --- a/src/Header/Exception/RuntimeException.php +++ b/src/Header/Exception/RuntimeException.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header\Exception; use Zend\Mail\Exception; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class RuntimeException extends Exception\RuntimeException implements ExceptionInterface {} diff --git a/src/Header/From.php b/src/Header/From.php index 34f9446b..fa7859e0 100644 --- a/src/Header/From.php +++ b/src/Header/From.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class From extends AbstractAddressList { protected $fieldName = 'From'; diff --git a/src/Header/GenericHeader.php b/src/Header/GenericHeader.php index 71b9261e..67834e93 100644 --- a/src/Header/GenericHeader.php +++ b/src/Header/GenericHeader.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class GenericHeader implements HeaderInterface, UnstructuredInterface { /** diff --git a/src/Header/GenericMultiHeader.php b/src/Header/GenericMultiHeader.php index 5bf07cc4..2c56d7a9 100644 --- a/src/Header/GenericMultiHeader.php +++ b/src/Header/GenericMultiHeader.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; /** * Generic class for Headers with multiple occurs in the same message - * - * @category Zend - * @package Zend_Mail - * @subpackage Header */ class GenericMultiHeader extends GenericHeader implements MultipleHeadersInterface { diff --git a/src/Header/HeaderInterface.php b/src/Header/HeaderInterface.php index 1c668be9..5ff0e8d3 100644 --- a/src/Header/HeaderInterface.php +++ b/src/Header/HeaderInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ interface HeaderInterface { /** diff --git a/src/Header/HeaderLoader.php b/src/Header/HeaderLoader.php index 412d9f65..37e6ab0f 100644 --- a/src/Header/HeaderLoader.php +++ b/src/Header/HeaderLoader.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; @@ -14,10 +13,6 @@ /** * Plugin Class Loader implementation for HTTP headers - * - * @category Zend - * @package Zend_Mail - * @subpackage Header */ class HeaderLoader extends PluginClassLoader { diff --git a/src/Header/HeaderWrap.php b/src/Header/HeaderWrap.php index adc85aa1..4ea98f6a 100644 --- a/src/Header/HeaderWrap.php +++ b/src/Header/HeaderWrap.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; @@ -16,10 +15,6 @@ /** * Utility class used for creating wrapped or MIME-encoded versions of header * values. - * - * @category Zend - * @package Zend_Mail - * @subpackage Header */ abstract class HeaderWrap { diff --git a/src/Header/MessageId.php b/src/Header/MessageId.php index 8649f8a9..a399e2b6 100644 --- a/src/Header/MessageId.php +++ b/src/Header/MessageId.php @@ -5,17 +5,11 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class MessageId implements HeaderInterface { /** diff --git a/src/Header/MimeVersion.php b/src/Header/MimeVersion.php index 703727b3..2a98426e 100644 --- a/src/Header/MimeVersion.php +++ b/src/Header/MimeVersion.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class MimeVersion implements HeaderInterface { /** diff --git a/src/Header/MultipleHeadersInterface.php b/src/Header/MultipleHeadersInterface.php index 0fc9676d..36f0b70f 100644 --- a/src/Header/MultipleHeadersInterface.php +++ b/src/Header/MultipleHeadersInterface.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - */ interface MultipleHeadersInterface extends HeaderInterface { public function toStringMultipleHeaders(array $headers); diff --git a/src/Header/Received.php b/src/Header/Received.php index a6b32f28..36b38045 100644 --- a/src/Header/Received.php +++ b/src/Header/Received.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; @@ -14,9 +13,6 @@ /** * @todo Allow setting date from DateTime, Zend\Date, or string - * @category Zend - * @package Zend_Mail - * @subpackage Header */ class Received implements HeaderInterface, MultipleHeadersInterface { diff --git a/src/Header/ReplyTo.php b/src/Header/ReplyTo.php index be4f7bc1..b9fa5e6d 100644 --- a/src/Header/ReplyTo.php +++ b/src/Header/ReplyTo.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class ReplyTo extends AbstractAddressList { protected $fieldName = 'Reply-To'; diff --git a/src/Header/Sender.php b/src/Header/Sender.php index 9a4ee430..82b5f92a 100644 --- a/src/Header/Sender.php +++ b/src/Header/Sender.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; use Zend\Mail; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class Sender implements HeaderInterface { /** diff --git a/src/Header/StructuredInterface.php b/src/Header/StructuredInterface.php index 8e25e9b9..734bd3e0 100644 --- a/src/Header/StructuredInterface.php +++ b/src/Header/StructuredInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ interface StructuredInterface extends HeaderInterface { /** diff --git a/src/Header/Subject.php b/src/Header/Subject.php index 6e8185ee..8f40d95f 100644 --- a/src/Header/Subject.php +++ b/src/Header/Subject.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class Subject implements UnstructuredInterface { /** diff --git a/src/Header/To.php b/src/Header/To.php index 12dee418..a26bca2b 100644 --- a/src/Header/To.php +++ b/src/Header/To.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Header - */ class To extends AbstractAddressList { protected $fieldName = 'To'; diff --git a/src/Header/UnstructuredInterface.php b/src/Header/UnstructuredInterface.php index 24ca8ef8..7e5daa58 100644 --- a/src/Header/UnstructuredInterface.php +++ b/src/Header/UnstructuredInterface.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Header; /** * Marker interface for unstructured headers. - * - * @category Zend - * @package Zend_Mail - * @subpackage Header */ interface UnstructuredInterface extends HeaderInterface { diff --git a/src/Headers.php b/src/Headers.php index 3d8ba00a..d62c7544 100644 --- a/src/Headers.php +++ b/src/Headers.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail; @@ -20,10 +19,6 @@ * Basic mail headers collection functionality * * Handles aggregation of headers - * - * @category Zend - * @package Zend_Mail - * @subpackage Header */ class Headers implements Countable, Iterator { diff --git a/src/Message.php b/src/Message.php index 9b63b7cd..04c39a62 100644 --- a/src/Message.php +++ b/src/Message.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail; @@ -13,10 +12,6 @@ use Traversable; use Zend\Mime; -/** - * @category Zend - * @package Zend_Mail - */ class Message { /** @@ -535,4 +530,25 @@ public function toString() . Headers::EOL . $this->getBodyText(); } + + /** + * Instantiate from raw message string + * + * @todo Restore body to Mime\Message + * @param string $rawMessage + * @return Message + */ + public static function fromString($rawMessage) + { + $message = new static(); + $headers = null; + $content = null; + Mime\Decode::splitMessage($rawMessage, $headers, $content); + if ($headers->has('mime-version')) { + // todo - restore body to mime\message + } + $message->setHeaders($headers); + $message->setBody($content); + return $message; + } } diff --git a/src/Protocol/AbstractProtocol.php b/src/Protocol/AbstractProtocol.php index f8b13cdd..308536f4 100644 --- a/src/Protocol/AbstractProtocol.php +++ b/src/Protocol/AbstractProtocol.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol; @@ -15,9 +14,6 @@ /** * Provides low-level methods for concrete adapters to communicate with a remote mail server and track requests and responses. * - * @category Zend - * @package Zend_Mail - * @subpackage Protocol * @todo Implement proxy settings */ abstract class AbstractProtocol @@ -99,7 +95,7 @@ abstract class AbstractProtocol public function __construct($host = '127.0.0.1', $port = null) { $this->validHost = new Validator\ValidatorChain(); - $this->validHost->addValidator(new Validator\Hostname(Validator\Hostname::ALLOW_ALL)); + $this->validHost->attach(new Validator\Hostname(Validator\Hostname::ALLOW_ALL)); if (!$this->validHost->isValid($host)) { throw new Exception\RuntimeException(implode(', ', $this->validHost->getMessages())); diff --git a/src/Protocol/Exception/ExceptionInterface.php b/src/Protocol/Exception/ExceptionInterface.php index 40e05ab2..66a5c23f 100644 --- a/src/Protocol/Exception/ExceptionInterface.php +++ b/src/Protocol/Exception/ExceptionInterface.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol\Exception; use Zend\Mail\Exception\ExceptionInterface as MailException; -/** - * @category Zend - * @package Zend_Mail - */ interface ExceptionInterface extends MailException { } diff --git a/src/Protocol/Exception/InvalidArgumentException.php b/src/Protocol/Exception/InvalidArgumentException.php index fef63a88..85032486 100644 --- a/src/Protocol/Exception/InvalidArgumentException.php +++ b/src/Protocol/Exception/InvalidArgumentException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface diff --git a/src/Protocol/Exception/RuntimeException.php b/src/Protocol/Exception/RuntimeException.php index 8c08850d..c47d3d32 100644 --- a/src/Protocol/Exception/RuntimeException.php +++ b/src/Protocol/Exception/RuntimeException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class RuntimeException extends Exception\RuntimeException implements ExceptionInterface diff --git a/src/Protocol/Imap.php b/src/Protocol/Imap.php index f580e483..0cc90c37 100644 --- a/src/Protocol/Imap.php +++ b/src/Protocol/Imap.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Protocol - */ class Imap { /** @@ -70,12 +64,26 @@ public function __destruct() */ public function connect($host, $port = null, $ssl = false) { - if ($ssl == 'SSL') { - $host = 'ssl://' . $host; + $isTls = false; + + if ($ssl) { + $ssl = strtolower($ssl); } - if ($port === null) { - $port = $ssl === 'SSL' ? 993 : 143; + switch ($ssl) { + case 'ssl': + $host = 'ssl://' . $host; + if (!$port) { + $port = 993; + } + break; + case 'tls': + $isTls = true; + // break intentionally omitted + default: + if (!$port) { + $port = 143; + } } ErrorHandler::start(); @@ -83,7 +91,7 @@ public function connect($host, $port = null, $ssl = false) $error = ErrorHandler::stop(); if (!$this->socket) { throw new Exception\RuntimeException(sprintf( - 'cannot connect to host%s', + 'cannot connect to host %s', ($error ? sprintf('; error = %s (errno = %d )', $error->getMessage(), $error->getCode()) : '') ), 0, $error); } @@ -92,7 +100,7 @@ public function connect($host, $port = null, $ssl = false) throw new Exception\RuntimeException('host doesn\'t allow connection'); } - if ($ssl === 'TLS') { + if ($isTls) { $result = $this->requestAndResponse('STARTTLS'); $result = $result && stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); if (!$result) { diff --git a/src/Protocol/Pop3.php b/src/Protocol/Pop3.php index 960acaed..d22fc6f4 100644 --- a/src/Protocol/Pop3.php +++ b/src/Protocol/Pop3.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Protocol - */ class Pop3 { /** @@ -78,12 +72,26 @@ public function __destruct() */ public function connect($host, $port = null, $ssl = false) { - if ($ssl == 'SSL') { - $host = 'ssl://' . $host; + $isTls = false; + + if ($ssl) { + $ssl = strtolower($ssl); } - if ($port === null) { - $port = $ssl == 'SSL' ? 995 : 110; + switch ($ssl) { + case 'ssl': + $host = 'ssl://' . $host; + if (!$port) { + $port = 995; + } + break; + case 'tls': + $isTls = true; + // break intentionally omitted + default: + if (!$port) { + $port = 110; + } } ErrorHandler::start(); @@ -91,7 +99,7 @@ public function connect($host, $port = null, $ssl = false) $error = ErrorHandler::stop(); if (!$this->socket) { throw new Exception\RuntimeException(sprintf( - 'cannot connect to host%s', + 'cannot connect to host %s', ($error ? sprintf('; error = %s (errno = %d )', $error->getMessage(), $error->getCode()) : '') ), 0, $error); } @@ -106,7 +114,7 @@ public function connect($host, $port = null, $ssl = false) $this->timestamp = '<' . $this->timestamp . '>'; } - if ($ssl === 'TLS') { + if ($isTls) { $this->request('STLS'); $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); if (!$result) { diff --git a/src/Protocol/Smtp.php b/src/Protocol/Smtp.php index 79ac61c1..1e7d17ea 100644 --- a/src/Protocol/Smtp.php +++ b/src/Protocol/Smtp.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol; @@ -14,10 +13,6 @@ * SMTP implementation of Zend\Mail\Protocol\AbstractProtocol * * Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT - * - * @category Zend - * @package Zend_Mail - * @subpackage Protocol */ class Smtp extends AbstractProtocol { @@ -198,6 +193,15 @@ public function helo($host = '127.0.0.1') $this->auth(); } + /** + * Returns the perceived session status + * + * @return boolean + */ + public function hasSession() + { + return $this->sess; + } /** * Send EHLO or HELO depending on capabilities of smtp host @@ -372,6 +376,7 @@ public function auth() */ public function disconnect() { + $this->quit(); $this->_disconnect(); } diff --git a/src/Protocol/Smtp/Auth/Crammd5.php b/src/Protocol/Smtp/Auth/Crammd5.php index 63eac164..dbcaa07c 100644 --- a/src/Protocol/Smtp/Auth/Crammd5.php +++ b/src/Protocol/Smtp/Auth/Crammd5.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol\Smtp\Auth; @@ -14,10 +13,6 @@ /** * Performs CRAM-MD5 authentication - * - * @category Zend - * @package Zend_Mail - * @subpackage Protocol */ class Crammd5 extends Smtp { diff --git a/src/Protocol/Smtp/Auth/Login.php b/src/Protocol/Smtp/Auth/Login.php index 324b8695..bcc2c8c4 100644 --- a/src/Protocol/Smtp/Auth/Login.php +++ b/src/Protocol/Smtp/Auth/Login.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol\Smtp\Auth; @@ -14,10 +13,6 @@ /** * Performs LOGIN authentication - * - * @category Zend - * @package Zend_Mail - * @subpackage Protocol */ class Login extends Smtp { diff --git a/src/Protocol/Smtp/Auth/Plain.php b/src/Protocol/Smtp/Auth/Plain.php index 79d2ca7c..97d028dc 100644 --- a/src/Protocol/Smtp/Auth/Plain.php +++ b/src/Protocol/Smtp/Auth/Plain.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol\Smtp\Auth; @@ -14,10 +13,6 @@ /** * Performs PLAIN authentication - * - * @category Zend - * @package Zend_Mail - * @subpackage Protocol */ class Plain extends Smtp { diff --git a/src/Protocol/SmtpPluginManager.php b/src/Protocol/SmtpPluginManager.php index 9cca5dec..0aad2a5b 100644 --- a/src/Protocol/SmtpPluginManager.php +++ b/src/Protocol/SmtpPluginManager.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Protocol; @@ -17,10 +16,6 @@ * * Enforces that SMTP extensions retrieved are instances of Smtp. Additionally, * it registers a number of default extensions available. - * - * @category Zend - * @package Zend_Mail - * @subpackage Protocol */ class SmtpPluginManager extends AbstractPluginManager { diff --git a/src/Storage.php b/src/Storage.php index af28219e..85ea79ee 100644 --- a/src/Storage.php +++ b/src/Storage.php @@ -5,15 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail; -/** - * @category Zend - * @package Zend_Mail - */ class Storage { // maildir and IMAP flags, using IMAP names, where possible to be able to distinguish between IMAP diff --git a/src/Storage/AbstractStorage.php b/src/Storage/AbstractStorage.php index 9d7bf55a..c79dc332 100644 --- a/src/Storage/AbstractStorage.php +++ b/src/Storage/AbstractStorage.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; @@ -14,11 +13,6 @@ use Countable; use SeekableIterator; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ abstract class AbstractStorage implements ArrayAccess, Countable, diff --git a/src/Storage/Exception/ExceptionInterface.php b/src/Storage/Exception/ExceptionInterface.php index 969a9389..8425b8ab 100644 --- a/src/Storage/Exception/ExceptionInterface.php +++ b/src/Storage/Exception/ExceptionInterface.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Exception; use Zend\Mail\Exception\ExceptionInterface as MailException; -/** - * @category Zend - * @package Zend_Mail - */ interface ExceptionInterface extends MailException { } diff --git a/src/Storage/Exception/InvalidArgumentException.php b/src/Storage/Exception/InvalidArgumentException.php index 2af1d9c8..0426b61f 100644 --- a/src/Storage/Exception/InvalidArgumentException.php +++ b/src/Storage/Exception/InvalidArgumentException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface diff --git a/src/Storage/Exception/OutOfBoundsException.php b/src/Storage/Exception/OutOfBoundsException.php index 6cd0559f..f280090a 100644 --- a/src/Storage/Exception/OutOfBoundsException.php +++ b/src/Storage/Exception/OutOfBoundsException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Exception; @@ -14,10 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail - * @subpackage Storage */ class OutOfBoundsException extends Exception\OutOfBoundsException implements ExceptionInterface diff --git a/src/Storage/Exception/RuntimeException.php b/src/Storage/Exception/RuntimeException.php index 4966fbbc..c60a5e38 100644 --- a/src/Storage/Exception/RuntimeException.php +++ b/src/Storage/Exception/RuntimeException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class RuntimeException extends Exception\RuntimeException implements ExceptionInterface diff --git a/src/Storage/Folder.php b/src/Storage/Folder.php index f5fa734a..094cd800 100644 --- a/src/Storage/Folder.php +++ b/src/Storage/Folder.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; use RecursiveIterator; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Folder implements RecursiveIterator { /** diff --git a/src/Storage/Folder/FolderInterface.php b/src/Storage/Folder/FolderInterface.php index 12307727..e94b525c 100644 --- a/src/Storage/Folder/FolderInterface.php +++ b/src/Storage/Folder/FolderInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Folder; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ interface FolderInterface { /** diff --git a/src/Storage/Folder/Maildir.php b/src/Storage/Folder/Maildir.php index 628508a4..715cfc56 100644 --- a/src/Storage/Folder/Maildir.php +++ b/src/Storage/Folder/Maildir.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Folder; @@ -14,11 +13,6 @@ use Zend\Mail\Storage\Exception; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Maildir extends Storage\Maildir implements FolderInterface { /** diff --git a/src/Storage/Folder/Mbox.php b/src/Storage/Folder/Mbox.php index f392b5a2..aae3e183 100644 --- a/src/Storage/Folder/Mbox.php +++ b/src/Storage/Folder/Mbox.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Folder; @@ -14,11 +13,6 @@ use Zend\Mail\Storage\Exception; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Mbox extends Storage\Mbox implements FolderInterface { /** diff --git a/src/Storage/Imap.php b/src/Storage/Imap.php index 5072f127..9ef870dc 100644 --- a/src/Storage/Imap.php +++ b/src/Storage/Imap.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; @@ -13,11 +12,6 @@ use Zend\Mail; use Zend\Mail\Protocol; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Imap extends AbstractStorage implements Folder\FolderInterface, Writable\WritableInterface { // TODO: with an internal cache we could optimize this class, or create an extra class with diff --git a/src/Storage/Maildir.php b/src/Storage/Maildir.php index 0c76a3d4..3e625339 100644 --- a/src/Storage/Maildir.php +++ b/src/Storage/Maildir.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; @@ -13,11 +12,6 @@ use Zend\Mail; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Maildir extends AbstractStorage { /** diff --git a/src/Storage/Mbox.php b/src/Storage/Mbox.php index 19a40af0..d6452091 100644 --- a/src/Storage/Mbox.php +++ b/src/Storage/Mbox.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Mbox extends AbstractStorage { /** diff --git a/src/Storage/Message.php b/src/Storage/Message.php index a829c832..13dc9aaf 100644 --- a/src/Storage/Message.php +++ b/src/Storage/Message.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - */ class Message extends Part implements Message\MessageInterface { /** diff --git a/src/Storage/Message/File.php b/src/Storage/Message/File.php index 77346037..f1eaf276 100644 --- a/src/Storage/Message/File.php +++ b/src/Storage/Message/File.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Message; use Zend\Mail\Storage\Part; -/** - * @category Zend - * @package Zend_Mail - */ class File extends Part\File implements MessageInterface { /** diff --git a/src/Storage/Message/MessageInterface.php b/src/Storage/Message/MessageInterface.php index e6635b06..76da37a3 100644 --- a/src/Storage/Message/MessageInterface.php +++ b/src/Storage/Message/MessageInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Message; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ interface MessageInterface { /** diff --git a/src/Storage/Part.php b/src/Storage/Part.php index ebe8678c..c75f4f48 100644 --- a/src/Storage/Part.php +++ b/src/Storage/Part.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; @@ -15,11 +14,6 @@ use Zend\Mail\Header\HeaderInterface; use Zend\Mime; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Part implements RecursiveIterator, Part\PartInterface { /** diff --git a/src/Storage/Part/Exception/ExceptionInterface.php b/src/Storage/Part/Exception/ExceptionInterface.php index 0b26fbae..ea6a77ee 100644 --- a/src/Storage/Part/Exception/ExceptionInterface.php +++ b/src/Storage/Part/Exception/ExceptionInterface.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Part\Exception; use Zend\Mail\Storage\Exception\ExceptionInterface as StorageException; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ interface ExceptionInterface extends StorageException { } diff --git a/src/Storage/Part/Exception/InvalidArgumentException.php b/src/Storage/Part/Exception/InvalidArgumentException.php index 82387952..ed38c79d 100644 --- a/src/Storage/Part/Exception/InvalidArgumentException.php +++ b/src/Storage/Part/Exception/InvalidArgumentException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Part\Exception; @@ -14,10 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail - * @subpackage Storage */ class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface diff --git a/src/Storage/Part/Exception/RuntimeException.php b/src/Storage/Part/Exception/RuntimeException.php index 1e0b5244..b067ba00 100644 --- a/src/Storage/Part/Exception/RuntimeException.php +++ b/src/Storage/Part/Exception/RuntimeException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Part\Exception; @@ -14,10 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @subpackage Storage - * @package Zend_Mail */ class RuntimeException extends Exception\RuntimeException implements ExceptionInterface diff --git a/src/Storage/Part/File.php b/src/Storage/Part/File.php index a7b9d7a6..53d415bd 100644 --- a/src/Storage/Part/File.php +++ b/src/Storage/Part/File.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Part; @@ -13,11 +12,6 @@ use Zend\Mail\Headers; use Zend\Mail\Storage\Part; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class File extends Part { protected $contentPos = array(); diff --git a/src/Storage/Part/PartInterface.php b/src/Storage/Part/PartInterface.php index 82db409f..ab90d1fd 100644 --- a/src/Storage/Part/PartInterface.php +++ b/src/Storage/Part/PartInterface.php @@ -5,18 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Part; use RecursiveIterator; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ interface PartInterface extends RecursiveIterator { /** diff --git a/src/Storage/Pop3.php b/src/Storage/Pop3.php index 4a690eda..1043b915 100644 --- a/src/Storage/Pop3.php +++ b/src/Storage/Pop3.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage; @@ -14,11 +13,6 @@ use Zend\Mail\Protocol; use Zend\Mime; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Pop3 extends AbstractStorage { /** diff --git a/src/Storage/Writable/Maildir.php b/src/Storage/Writable/Maildir.php index 174651bf..90a571e3 100644 --- a/src/Storage/Writable/Maildir.php +++ b/src/Storage/Writable/Maildir.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Writable; @@ -16,11 +15,6 @@ use Zend\Mail\Storage\Folder; use Zend\Stdlib\ErrorHandler; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ class Maildir extends Folder\Maildir implements WritableInterface { // TODO: init maildir (+ constructor option create if not found) diff --git a/src/Storage/Writable/WritableInterface.php b/src/Storage/Writable/WritableInterface.php index e41978b8..cad542b1 100644 --- a/src/Storage/Writable/WritableInterface.php +++ b/src/Storage/Writable/WritableInterface.php @@ -5,16 +5,10 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Storage\Writable; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Storage - */ interface WritableInterface { /** diff --git a/src/Transport/Exception/ExceptionInterface.php b/src/Transport/Exception/ExceptionInterface.php index 0459ce04..fb51811d 100644 --- a/src/Transport/Exception/ExceptionInterface.php +++ b/src/Transport/Exception/ExceptionInterface.php @@ -5,17 +5,12 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport\Exception; use Zend\Mail\Exception\ExceptionInterface as MailException; -/** - * @category Zend - * @package Zend_Mail - */ interface ExceptionInterface extends MailException { } diff --git a/src/Transport/Exception/InvalidArgumentException.php b/src/Transport/Exception/InvalidArgumentException.php index 1b8fbbd7..f86e8569 100644 --- a/src/Transport/Exception/InvalidArgumentException.php +++ b/src/Transport/Exception/InvalidArgumentException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class InvalidArgumentException extends Exception\InvalidArgumentException implements ExceptionInterface diff --git a/src/Transport/Exception/RuntimeException.php b/src/Transport/Exception/RuntimeException.php index 08eade60..c86a94d6 100644 --- a/src/Transport/Exception/RuntimeException.php +++ b/src/Transport/Exception/RuntimeException.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport\Exception; @@ -14,9 +13,6 @@ /** * Exception for Zend_Mail component. - * - * @category Zend - * @package Zend_Mail */ class RuntimeException extends Exception\RuntimeException implements ExceptionInterface diff --git a/src/Transport/File.php b/src/Transport/File.php index 47e3adb4..cf3258c7 100644 --- a/src/Transport/File.php +++ b/src/Transport/File.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport; @@ -16,10 +15,6 @@ * File transport * * Class for saving outgoing emails in filesystem - * - * @category Zend - * @package Zend_Mail - * @subpackage Transport */ class File implements TransportInterface { diff --git a/src/Transport/FileOptions.php b/src/Transport/FileOptions.php index f1abee9b..1ad0e75c 100644 --- a/src/Transport/FileOptions.php +++ b/src/Transport/FileOptions.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport; @@ -13,11 +12,6 @@ use Zend\Mail\Exception; use Zend\Stdlib\AbstractOptions; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Transport - */ class FileOptions extends AbstractOptions { /** diff --git a/src/Transport/Sendmail.php b/src/Transport/Sendmail.php index e35273f5..d5d607cf 100644 --- a/src/Transport/Sendmail.php +++ b/src/Transport/Sendmail.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport; @@ -18,10 +17,6 @@ /** * Class for sending email via the PHP internal mail() function - * - * @category Zend - * @package Zend_Mail - * @subpackage Transport */ class Sendmail implements TransportInterface { diff --git a/src/Transport/Smtp.php b/src/Transport/Smtp.php index ff19cd5b..f7216779 100644 --- a/src/Transport/Smtp.php +++ b/src/Transport/Smtp.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport; @@ -20,10 +19,6 @@ * SMTP connection object * * Loads an instance of Zend\Mail\Protocol\Smtp and forwards smtp transactions - * - * @category Zend - * @package Zend_Mail - * @subpackage Transport */ class Smtp implements TransportInterface { @@ -206,9 +201,8 @@ public function send(Message $message) // If sending multiple messages per session use existing adapter $connection = $this->getConnection(); - if (!($connection instanceof Protocol\Smtp)) { - // First time connecting - $connection = $this->lazyLoadConnection(); + if (!($connection instanceof Protocol\Smtp) || !$connection->hasSession()) { + $connection = $this->connect(); } else { // Reset connection to ensure reliable transaction $connection->rset(); @@ -327,8 +321,21 @@ protected function lazyLoadConnection() $config['port'] = $options->getPort(); $connection = $this->plugin($options->getConnectionClass(), $config); $this->connection = $connection; + return $this->connect(); + } + + /** + * Connect the connection, and pass it helo + * + * @return Protocol\Smtp + */ + protected function connect() + { + if (!$this->connection instanceof Protocol\Smtp) { + $this->lazyLoadConnection(); + } $this->connection->connect(); - $this->connection->helo($options->getName()); + $this->connection->helo($this->getOptions()->getName()); return $this->connection; } } diff --git a/src/Transport/SmtpOptions.php b/src/Transport/SmtpOptions.php index 22adebd7..795c3fb9 100644 --- a/src/Transport/SmtpOptions.php +++ b/src/Transport/SmtpOptions.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport; @@ -13,11 +12,6 @@ use Zend\Mail\Exception; use Zend\Stdlib\AbstractOptions; -/** - * @category Zend - * @package Zend_Mail - * @subpackage Transport - */ class SmtpOptions extends AbstractOptions { /** diff --git a/src/Transport/TransportInterface.php b/src/Transport/TransportInterface.php index dc6c5c8e..e087ec6d 100644 --- a/src/Transport/TransportInterface.php +++ b/src/Transport/TransportInterface.php @@ -5,7 +5,6 @@ * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @package Zend_Mail */ namespace Zend\Mail\Transport; @@ -14,10 +13,6 @@ /** * Interface for mail transports - * - * @category Zend - * @package Zend_Mail - * @subpackage Transport */ interface TransportInterface { diff --git a/test/MessageTest.php b/test/MessageTest.php index 718e5420..b57c4a86 100644 --- a/test/MessageTest.php +++ b/test/MessageTest.php @@ -56,7 +56,7 @@ public function testSetsOrigDateHeaderByDefault() public function testAddingFromAddressMarksAsValid() { - $this->message->addFrom('zf-devteam@zend.com'); + $this->message->addFrom('zf-devteam@example.com'); $this->assertTrue($this->message->isValid()); } @@ -68,14 +68,14 @@ public function testHeadersMethodReturnsHeadersObject() public function testToMethodReturnsAddressListObject() { - $this->message->addTo('zf-devteam@zend.com'); + $this->message->addTo('zf-devteam@example.com'); $to = $this->message->getTo(); $this->assertInstanceOf('Zend\Mail\AddressList', $to); } public function testToAddressListLivesInHeaders() { - $this->message->addTo('zf-devteam@zend.com'); + $this->message->addTo('zf-devteam@example.com'); $to = $this->message->getTo(); $headers = $this->message->getHeaders(); $this->assertInstanceOf('Zend\Mail\Headers', $headers); @@ -86,14 +86,14 @@ public function testToAddressListLivesInHeaders() public function testFromMethodReturnsAddressListObject() { - $this->message->addFrom('zf-devteam@zend.com'); + $this->message->addFrom('zf-devteam@example.com'); $from = $this->message->getFrom(); $this->assertInstanceOf('Zend\Mail\AddressList', $from); } public function testFromAddressListLivesInHeaders() { - $this->message->addFrom('zf-devteam@zend.com'); + $this->message->addFrom('zf-devteam@example.com'); $from = $this->message->getFrom(); $headers = $this->message->getHeaders(); $this->assertInstanceOf('Zend\Mail\Headers', $headers); @@ -104,14 +104,14 @@ public function testFromAddressListLivesInHeaders() public function testCcMethodReturnsAddressListObject() { - $this->message->addCc('zf-devteam@zend.com'); + $this->message->addCc('zf-devteam@example.com'); $cc = $this->message->getCc(); $this->assertInstanceOf('Zend\Mail\AddressList', $cc); } public function testCcAddressListLivesInHeaders() { - $this->message->addCc('zf-devteam@zend.com'); + $this->message->addCc('zf-devteam@example.com'); $cc = $this->message->getCc(); $headers = $this->message->getHeaders(); $this->assertInstanceOf('Zend\Mail\Headers', $headers); @@ -122,14 +122,14 @@ public function testCcAddressListLivesInHeaders() public function testBccMethodReturnsAddressListObject() { - $this->message->addBcc('zf-devteam@zend.com'); + $this->message->addBcc('zf-devteam@example.com'); $bcc = $this->message->getBcc(); $this->assertInstanceOf('Zend\Mail\AddressList', $bcc); } public function testBccAddressListLivesInHeaders() { - $this->message->addBcc('zf-devteam@zend.com'); + $this->message->addBcc('zf-devteam@example.com'); $bcc = $this->message->getBcc(); $headers = $this->message->getHeaders(); $this->assertInstanceOf('Zend\Mail\Headers', $headers); @@ -140,14 +140,14 @@ public function testBccAddressListLivesInHeaders() public function testReplyToMethodReturnsAddressListObject() { - $this->message->addReplyTo('zf-devteam@zend.com'); + $this->message->addReplyTo('zf-devteam@example.com'); $replyTo = $this->message->getReplyTo(); $this->assertInstanceOf('Zend\Mail\AddressList', $replyTo); } public function testReplyToAddressListLivesInHeaders() { - $this->message->addReplyTo('zf-devteam@zend.com'); + $this->message->addReplyTo('zf-devteam@example.com'); $replyTo = $this->message->getReplyTo(); $headers = $this->message->getHeaders(); $this->assertInstanceOf('Zend\Mail\Headers', $headers); @@ -163,14 +163,14 @@ public function testSenderIsNullByDefault() public function testSettingSenderCreatesAddressObject() { - $this->message->setSender('zf-devteam@zend.com'); + $this->message->setSender('zf-devteam@example.com'); $sender = $this->message->getSender(); $this->assertInstanceOf('Zend\Mail\Address', $sender); } public function testCanSpecifyNameWhenSettingSender() { - $this->message->setSender('zf-devteam@zend.com', 'ZF DevTeam'); + $this->message->setSender('zf-devteam@example.com', 'ZF DevTeam'); $sender = $this->message->getSender(); $this->assertInstanceOf('Zend\Mail\Address', $sender); $this->assertEquals('ZF DevTeam', $sender->getName()); @@ -178,7 +178,7 @@ public function testCanSpecifyNameWhenSettingSender() public function testCanProvideAddressObjectWhenSettingSender() { - $sender = new Address('zf-devteam@zend.com'); + $sender = new Address('zf-devteam@example.com'); $this->message->setSender($sender); $test = $this->message->getSender(); $this->assertSame($sender, $test); @@ -188,24 +188,24 @@ public function testSenderAccessorsProxyToSenderHeader() { $header = new Header\Sender(); $this->message->getHeaders()->addHeader($header); - $address = new Address('zf-devteam@zend.com', 'ZF DevTeam'); + $address = new Address('zf-devteam@example.com', 'ZF DevTeam'); $this->message->setSender($address); $this->assertSame($address, $header->getAddress()); } public function testCanAddFromAddressUsingName() { - $this->message->addFrom('zf-devteam@zend.com', 'ZF DevTeam'); + $this->message->addFrom('zf-devteam@example.com', 'ZF DevTeam'); $addresses = $this->message->getFrom(); $this->assertEquals(1, count($addresses)); $address = $addresses->current(); - $this->assertEquals('zf-devteam@zend.com', $address->getEmail()); + $this->assertEquals('zf-devteam@example.com', $address->getEmail()); $this->assertEquals('ZF DevTeam', $address->getName()); } public function testCanAddFromAddressUsingAddressObject() { - $address = new Address('zf-devteam@zend.com', 'ZF DevTeam'); + $address = new Address('zf-devteam@example.com', 'ZF DevTeam'); $this->message->addFrom($address); $addresses = $this->message->getFrom(); @@ -217,59 +217,59 @@ public function testCanAddFromAddressUsingAddressObject() public function testCanAddManyFromAddressesUsingArray() { $addresses = array( - 'zf-devteam@zend.com', - 'zf-contributors@lists.zend.com' => 'ZF Contributors List', - new Address('fw-announce@lists.zend.com', 'ZF Announce List'), + 'zf-devteam@example.com', + 'zf-contributors@example.com' => 'ZF Contributors List', + new Address('fw-announce@example.com', 'ZF Announce List'), ); $this->message->addFrom($addresses); $from = $this->message->getFrom(); $this->assertEquals(3, count($from)); - $this->assertTrue($from->has('zf-devteam@zend.com')); - $this->assertTrue($from->has('zf-contributors@lists.zend.com')); - $this->assertTrue($from->has('fw-announce@lists.zend.com')); + $this->assertTrue($from->has('zf-devteam@example.com')); + $this->assertTrue($from->has('zf-contributors@example.com')); + $this->assertTrue($from->has('fw-announce@example.com')); } public function testCanAddManyFromAddressesUsingAddressListObject() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addFrom('fw-announce@lists.zend.com'); + $this->message->addFrom('fw-announce@example.com'); $this->message->addFrom($list); $from = $this->message->getFrom(); $this->assertEquals(2, count($from)); - $this->assertTrue($from->has('fw-announce@lists.zend.com')); - $this->assertTrue($from->has('zf-devteam@zend.com')); + $this->assertTrue($from->has('fw-announce@example.com')); + $this->assertTrue($from->has('zf-devteam@example.com')); } public function testCanSetFromListFromAddressList() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addFrom('fw-announce@lists.zend.com'); + $this->message->addFrom('fw-announce@example.com'); $this->message->setFrom($list); $from = $this->message->getFrom(); $this->assertEquals(1, count($from)); - $this->assertFalse($from->has('fw-announce@lists.zend.com')); - $this->assertTrue($from->has('zf-devteam@zend.com')); + $this->assertFalse($from->has('fw-announce@example.com')); + $this->assertTrue($from->has('zf-devteam@example.com')); } public function testCanAddCcAddressUsingName() { - $this->message->addCc('zf-devteam@zend.com', 'ZF DevTeam'); + $this->message->addCc('zf-devteam@example.com', 'ZF DevTeam'); $addresses = $this->message->getCc(); $this->assertEquals(1, count($addresses)); $address = $addresses->current(); - $this->assertEquals('zf-devteam@zend.com', $address->getEmail()); + $this->assertEquals('zf-devteam@example.com', $address->getEmail()); $this->assertEquals('ZF DevTeam', $address->getName()); } public function testCanAddCcAddressUsingAddressObject() { - $address = new Address('zf-devteam@zend.com', 'ZF DevTeam'); + $address = new Address('zf-devteam@example.com', 'ZF DevTeam'); $this->message->addCc($address); $addresses = $this->message->getCc(); @@ -281,59 +281,59 @@ public function testCanAddCcAddressUsingAddressObject() public function testCanAddManyCcAddressesUsingArray() { $addresses = array( - 'zf-devteam@zend.com', - 'zf-contributors@lists.zend.com' => 'ZF Contributors List', - new Address('fw-announce@lists.zend.com', 'ZF Announce List'), + 'zf-devteam@example.com', + 'zf-contributors@example.com' => 'ZF Contributors List', + new Address('fw-announce@example.com', 'ZF Announce List'), ); $this->message->addCc($addresses); $cc = $this->message->getCc(); $this->assertEquals(3, count($cc)); - $this->assertTrue($cc->has('zf-devteam@zend.com')); - $this->assertTrue($cc->has('zf-contributors@lists.zend.com')); - $this->assertTrue($cc->has('fw-announce@lists.zend.com')); + $this->assertTrue($cc->has('zf-devteam@example.com')); + $this->assertTrue($cc->has('zf-contributors@example.com')); + $this->assertTrue($cc->has('fw-announce@example.com')); } public function testCanAddManyCcAddressesUsingAddressListObject() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addCc('fw-announce@lists.zend.com'); + $this->message->addCc('fw-announce@example.com'); $this->message->addCc($list); $cc = $this->message->getCc(); $this->assertEquals(2, count($cc)); - $this->assertTrue($cc->has('fw-announce@lists.zend.com')); - $this->assertTrue($cc->has('zf-devteam@zend.com')); + $this->assertTrue($cc->has('fw-announce@example.com')); + $this->assertTrue($cc->has('zf-devteam@example.com')); } public function testCanSetCcListFromAddressList() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addCc('fw-announce@lists.zend.com'); + $this->message->addCc('fw-announce@example.com'); $this->message->setCc($list); $cc = $this->message->getCc(); $this->assertEquals(1, count($cc)); - $this->assertFalse($cc->has('fw-announce@lists.zend.com')); - $this->assertTrue($cc->has('zf-devteam@zend.com')); + $this->assertFalse($cc->has('fw-announce@example.com')); + $this->assertTrue($cc->has('zf-devteam@example.com')); } public function testCanAddBccAddressUsingName() { - $this->message->addBcc('zf-devteam@zend.com', 'ZF DevTeam'); + $this->message->addBcc('zf-devteam@example.com', 'ZF DevTeam'); $addresses = $this->message->getBcc(); $this->assertEquals(1, count($addresses)); $address = $addresses->current(); - $this->assertEquals('zf-devteam@zend.com', $address->getEmail()); + $this->assertEquals('zf-devteam@example.com', $address->getEmail()); $this->assertEquals('ZF DevTeam', $address->getName()); } public function testCanAddBccAddressUsingAddressObject() { - $address = new Address('zf-devteam@zend.com', 'ZF DevTeam'); + $address = new Address('zf-devteam@example.com', 'ZF DevTeam'); $this->message->addBcc($address); $addresses = $this->message->getBcc(); @@ -345,59 +345,59 @@ public function testCanAddBccAddressUsingAddressObject() public function testCanAddManyBccAddressesUsingArray() { $addresses = array( - 'zf-devteam@zend.com', - 'zf-contributors@lists.zend.com' => 'ZF Contributors List', - new Address('fw-announce@lists.zend.com', 'ZF Announce List'), + 'zf-devteam@example.com', + 'zf-contributors@example.com' => 'ZF Contributors List', + new Address('fw-announce@example.com', 'ZF Announce List'), ); $this->message->addBcc($addresses); $bcc = $this->message->getBcc(); $this->assertEquals(3, count($bcc)); - $this->assertTrue($bcc->has('zf-devteam@zend.com')); - $this->assertTrue($bcc->has('zf-contributors@lists.zend.com')); - $this->assertTrue($bcc->has('fw-announce@lists.zend.com')); + $this->assertTrue($bcc->has('zf-devteam@example.com')); + $this->assertTrue($bcc->has('zf-contributors@example.com')); + $this->assertTrue($bcc->has('fw-announce@example.com')); } public function testCanAddManyBccAddressesUsingAddressListObject() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addBcc('fw-announce@lists.zend.com'); + $this->message->addBcc('fw-announce@example.com'); $this->message->addBcc($list); $bcc = $this->message->getBcc(); $this->assertEquals(2, count($bcc)); - $this->assertTrue($bcc->has('fw-announce@lists.zend.com')); - $this->assertTrue($bcc->has('zf-devteam@zend.com')); + $this->assertTrue($bcc->has('fw-announce@example.com')); + $this->assertTrue($bcc->has('zf-devteam@example.com')); } public function testCanSetBccListFromAddressList() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addBcc('fw-announce@lists.zend.com'); + $this->message->addBcc('fw-announce@example.com'); $this->message->setBcc($list); $bcc = $this->message->getBcc(); $this->assertEquals(1, count($bcc)); - $this->assertFalse($bcc->has('fw-announce@lists.zend.com')); - $this->assertTrue($bcc->has('zf-devteam@zend.com')); + $this->assertFalse($bcc->has('fw-announce@example.com')); + $this->assertTrue($bcc->has('zf-devteam@example.com')); } public function testCanAddReplyToAddressUsingName() { - $this->message->addReplyTo('zf-devteam@zend.com', 'ZF DevTeam'); + $this->message->addReplyTo('zf-devteam@example.com', 'ZF DevTeam'); $addresses = $this->message->getReplyTo(); $this->assertEquals(1, count($addresses)); $address = $addresses->current(); - $this->assertEquals('zf-devteam@zend.com', $address->getEmail()); + $this->assertEquals('zf-devteam@example.com', $address->getEmail()); $this->assertEquals('ZF DevTeam', $address->getName()); } public function testCanAddReplyToAddressUsingAddressObject() { - $address = new Address('zf-devteam@zend.com', 'ZF DevTeam'); + $address = new Address('zf-devteam@example.com', 'ZF DevTeam'); $this->message->addReplyTo($address); $addresses = $this->message->getReplyTo(); @@ -409,44 +409,44 @@ public function testCanAddReplyToAddressUsingAddressObject() public function testCanAddManyReplyToAddressesUsingArray() { $addresses = array( - 'zf-devteam@zend.com', - 'zf-contributors@lists.zend.com' => 'ZF Contributors List', - new Address('fw-announce@lists.zend.com', 'ZF Announce List'), + 'zf-devteam@example.com', + 'zf-contributors@example.com' => 'ZF Contributors List', + new Address('fw-announce@example.com', 'ZF Announce List'), ); $this->message->addReplyTo($addresses); $replyTo = $this->message->getReplyTo(); $this->assertEquals(3, count($replyTo)); - $this->assertTrue($replyTo->has('zf-devteam@zend.com')); - $this->assertTrue($replyTo->has('zf-contributors@lists.zend.com')); - $this->assertTrue($replyTo->has('fw-announce@lists.zend.com')); + $this->assertTrue($replyTo->has('zf-devteam@example.com')); + $this->assertTrue($replyTo->has('zf-contributors@example.com')); + $this->assertTrue($replyTo->has('fw-announce@example.com')); } public function testCanAddManyReplyToAddressesUsingAddressListObject() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addReplyTo('fw-announce@lists.zend.com'); + $this->message->addReplyTo('fw-announce@example.com'); $this->message->addReplyTo($list); $replyTo = $this->message->getReplyTo(); $this->assertEquals(2, count($replyTo)); - $this->assertTrue($replyTo->has('fw-announce@lists.zend.com')); - $this->assertTrue($replyTo->has('zf-devteam@zend.com')); + $this->assertTrue($replyTo->has('fw-announce@example.com')); + $this->assertTrue($replyTo->has('zf-devteam@example.com')); } public function testCanSetReplyToListFromAddressList() { $list = new AddressList(); - $list->add('zf-devteam@zend.com'); + $list->add('zf-devteam@example.com'); - $this->message->addReplyTo('fw-announce@lists.zend.com'); + $this->message->addReplyTo('fw-announce@example.com'); $this->message->setReplyTo($list); $replyTo = $this->message->getReplyTo(); $this->assertEquals(1, count($replyTo)); - $this->assertFalse($replyTo->has('fw-announce@lists.zend.com')); - $this->assertTrue($replyTo->has('zf-devteam@zend.com')); + $this->assertFalse($replyTo->has('fw-announce@example.com')); + $this->assertTrue($replyTo->has('zf-devteam@example.com')); } public function testSubjectIsEmptyByDefault() @@ -611,10 +611,10 @@ public function testMessageReturnsNonEncodedSubject() public function testSettingNonAsciiEncodingForcesMimeEncodingOfSomeHeaders() { - $this->message->addTo('zf-devteam@zend.com', 'ZF DevTeam'); - $this->message->addFrom('matthew@zend.com', "Matthew Weier O'Phinney"); - $this->message->addCc('zf-contributors@lists.zend.com', 'ZF Contributors List'); - $this->message->addBcc('zf-crteam@lists.zend.com', 'ZF CR Team'); + $this->message->addTo('zf-devteam@example.com', 'ZF DevTeam'); + $this->message->addFrom('matthew@example.com', "Matthew Weier O'Phinney"); + $this->message->addCc('zf-contributors@example.com', 'ZF Contributors List'); + $this->message->addBcc('zf-crteam@example.com', 'ZF CR Team'); $this->message->setSubject('This is a subject'); $this->message->setEncoding('UTF-8'); @@ -622,19 +622,19 @@ public function testSettingNonAsciiEncodingForcesMimeEncodingOfSomeHeaders() $expected = '=?UTF-8?Q?ZF=20DevTeam?='; $this->assertContains($expected, $test); - $this->assertContains('', $test); + $this->assertContains('', $test); $expected = "=?UTF-8?Q?Matthew=20Weier=20O'Phinney?="; $this->assertContains($expected, $test, $test); - $this->assertContains('', $test); + $this->assertContains('', $test); $expected = '=?UTF-8?Q?ZF=20Contributors=20List?='; $this->assertContains($expected, $test); - $this->assertContains('', $test); + $this->assertContains('', $test); $expected = '=?UTF-8?Q?ZF=20CR=20Team?='; $this->assertContains($expected, $test); - $this->assertContains('', $test); + $this->assertContains('', $test); $expected = 'Subject: =?UTF-8?Q?This=20is=20a=20subject?='; $this->assertContains($expected, $test); @@ -654,4 +654,16 @@ public function testDefaultDateHeaderEncodingIsAlwaysAscii() $test = substr($test, 0, 16); $this->assertEquals($date, $test); } + + public function testRestoreFromSerializedString() + { + $this->message->addTo('zf-devteam@example.com', 'ZF DevTeam'); + $this->message->addFrom('matthew@example.com', "Matthew Weier O'Phinney"); + $this->message->addCc('zf-contributors@example.com', 'ZF Contributors List'); + $this->message->setSubject('This is a subject'); + $this->message->setBody('foo'); + $serialized = $this->message->toString(); + $restoredMessage = Message::fromString($serialized); + $this->assertEquals($serialized, $restoredMessage->toString()); + } } diff --git a/test/Protocol/SmtpTest.php b/test/Protocol/SmtpTest.php index fc52a25f..aaa19830 100644 --- a/test/Protocol/SmtpTest.php +++ b/test/Protocol/SmtpTest.php @@ -46,7 +46,7 @@ public function testSendMinimalMail() ->setBody('testSendMailWithoutMinimalHeaders') ->addTo('zf-devteam@zend.com', 'ZF DevTeam') ; - $expectedMessage = "RSET\r\n" + $expectedMessage = "EHLO localhost\r\n" . "MAIL FROM:\r\n" . "DATA\r\n" . "Date: Sun, 10 Jun 2012 20:07:24 +0200\r\n" diff --git a/test/TestAsset/SmtpProtocolSpy.php b/test/TestAsset/SmtpProtocolSpy.php index feaec3e2..0fcdb4d5 100644 --- a/test/TestAsset/SmtpProtocolSpy.php +++ b/test/TestAsset/SmtpProtocolSpy.php @@ -24,7 +24,6 @@ class SmtpProtocolSpy extends Smtp protected $connect = false; protected $mail; protected $rcptTest = array(); - protected $sess = true; public function connect() { @@ -32,20 +31,20 @@ public function connect() return true; } - public function helo($serverName = '127.0.0.1') + public function disconnect() { - parent::helo($serverName); + $this->connect = false; + parent::disconnect(); } - public function quit() + public function helo($serverName = '127.0.0.1') { - $this->rset(); + parent::helo($serverName); } - public function disconnect() + public function quit() { - $this->connect = false; - $this->rset(); + parent::quit(); } public function rset() diff --git a/test/Transport/SmtpTest.php b/test/Transport/SmtpTest.php index 687dcb1e..35f485f8 100644 --- a/test/Transport/SmtpTest.php +++ b/test/Transport/SmtpTest.php @@ -157,7 +157,7 @@ public function testAutoDisconnectTrue() { $this->connection->connect(); unset($this->transport); - $this->assertFalse($this->connection->isConnected()); + $this->assertFalse($this->connection->hasSession()); } public function testAutoDisconnectFalse() @@ -175,4 +175,16 @@ public function testDisconnect() $this->transport->disconnect(); $this->assertFalse($this->connection->isConnected()); } + + public function testDisconnectSendReconnects() + { + $this->assertFalse($this->connection->hasSession()); + $this->transport->send($this->getMessage()); + $this->assertTrue($this->connection->hasSession()); + $this->connection->disconnect(); + + $this->assertFalse($this->connection->hasSession()); + $this->transport->send($this->getMessage()); + $this->assertTrue($this->connection->hasSession()); + } }