public function checkTransport($from)
    {
        if (! array_key_exists($from, self::$mailServers)) {
            $sql = 'SELECT * FROM gems__mail_servers WHERE ? LIKE gms_from ORDER BY LENGTH(gms_from) DESC LIMIT 1';

            // Always set cache, se we know when not to check for this row.
            $serverData = $this->db->fetchRow($sql, $from);

            // \MUtil_Echo::track($serverData);

            if (isset($serverData['gms_server'])) {
                $options = array();
                if (isset($serverData['gms_user'], $serverData['gms_password'])) {
                    $options['auth'] = 'login';
                    $options['username'] = $serverData['gms_user'];
                    $options['password'] = $this->project->decrypt($serverData['gms_password']);
                }
                if (isset($serverData['gms_port'])) {
                    $options['port'] = $serverData['gms_port'];
                }
                if (isset($serverData['gms_ssl'])) {
                    switch ($serverData['gms_ssl']) {
                        case self::MAIL_SSL:
                            $options['ssl'] = 'ssl';
                            break;

                        case self::MAIL_TLS:
                            $options['ssl'] = 'tls';
                            break;

                        default:
                            // intentional fall through

                    }
                }

                self::$mailServers[$from] = new \Zend_Mail_Transport_Smtp($serverData['gms_server'], $options);
            } else {
                self::$mailServers[$from] = $this->getDefaultTransport();
            }
        }

        return self::$mailServers[$from];
    }
public function checkTransport($from)
    {
        if (! array_key_exists($from, self::$mailServers)) {
            $sql = 'SELECT * FROM gems__mail_servers WHERE ? LIKE gms_from ORDER BY LENGTH(gms_from) DESC LIMIT 1';

            // Always set cache, se we know when not to check for this row.
            $serverData = $this->db->fetchRow($sql, $from);

            // \MUtil_Echo::track($serverData);

            if (isset($serverData['gms_server'])) {
                $options = array();
                if (isset($serverData['gms_user'], $serverData['gms_password'])) {
                    $options['auth'] = 'login';
                    $options['username'] = $serverData['gms_user'];
                    $options['password'] = $this->project->decrypt($serverData['gms_password']);
                }
                if (isset($serverData['gms_port'])) {
                    $options['port'] = $serverData['gms_port'];
                }
                if (isset($serverData['gms_ssl'])) {
                    switch ($serverData['gms_ssl']) {
                        case self::MAIL_SSL:
                            $options['ssl'] = 'ssl';
                            break;

                        case self::MAIL_TLS:
                            $options['ssl'] = 'tls';
                            break;

                        default:
                            // intentional fall through

                    }
                }

                self::$mailServers[$from] = new \Zend_Mail_Transport_Smtp($serverData['gms_server'], $options);
            } else {
                self::$mailServers[$from] = $this->getDefaultTransport();
            }
        }

        return self::$mailServers[$from];
    }
public function checkTransport ( $ from ) { if ( ! array_key_exists ( $ from , self :: $ mailServers ) ) { $ sql = 'SELECT * FROM gems__mail_servers WHERE ? LIKE gms_from ORDER BY LENGTH(gms_from) DESC LIMIT 1' ; // Always set cache, se we know when not to check for this row. $ serverData = $ this -> db -> fetchRow ( $ sql , $ from ) ; // \MUtil_Echo::track($serverData); if ( isset ( $ serverData [ 'gms_server' ] ) ) { $ options = array ( ) ; if ( isset ( $ serverData [ 'gms_user' ] , $ serverData [ 'gms_password' ] ) ) { $ options [ 'auth' ] = 'login' ; $ options [ 'username' ] = $ serverData [ 'gms_user' ] ; $ options [ 'password' ] = $ this -> project -> decrypt ( $ serverData [ 'gms_password' ] ) ; } if ( isset ( $ serverData [ 'gms_port' ] ) ) { $ options [ 'port' ] = $ serverData [ 'gms_port' ] ; } if ( isset ( $ serverData [ 'gms_ssl' ] ) ) { switch ( $ serverData [ 'gms_ssl' ] ) { case self :: MAIL_SSL : $ options [ 'ssl' ] = 'ssl' ; break ; case self :: MAIL_TLS : $ options [ 'ssl' ] = 'tls' ; break ; default : // intentional fall through } } self :: $ mailServers [ $ from ] = new \ Zend_Mail_Transport_Smtp ( $ serverData [ 'gms_server' ] , $ options ) ; } else { self :: $ mailServers [ $ from ] = $ this -> getDefaultTransport ( ) ; } } return self :: $ mailServers [ $ from ] ; }
Returns \Zend_Mail_Transport_Abstract when something else than the default mail protocol should be used.

@staticvar array $mailServers
@param email address $from
@return \Zend_Mail_Transport_Abstract or null
Returns \ Zend_Mail_Transport_Abstract when something else than the default mail protocol should be used .