Beispiel #1
0
    /**
     * @return \Zend\Mail\AbstractTransport|null
     */
    public function getMail()
    {
        if (null === $this->_transport) {
            $options = $this->getOptions();
            foreach($options as $key => $option) {
                $options[strtolower($key)] = $option;         
            }
            $this->setOptions($options);

            if(isset($options['transport']) &&
               !is_numeric($options['transport']))
            {
                $this->_transport = $this->_setupTransport($options['transport']);
                if(!isset($options['transport']['register']) ||
                   $options['transport']['register'] == '1' ||
                   (isset($options['transport']['register']) &&
                        !is_numeric($options['transport']['register']) &&
                        (bool) $options['transport']['register'] == true))
                {
                    \Zend\Mail\Mail::setDefaultTransport($this->_transport);
                }
            }
            
            $this->_setDefaults('from');
            $this->_setDefaults('replyTo');
        }

        return $this->_transport;
    }
Beispiel #2
0
	protected function setUp()
    {
        $this->_transport = $this->getMockForAbstractClass(
            'Zend\Mail\AbstractTransport',
            array()
        );
        \Zend\Mail\Mail::setDefaultTransport($this->_transport);
    }