src/core/framework/core/3rdparty/ezcomponents/Mail/src/transports/smtp/smtp_transport.php
protected function connect()
    {
        $errno = null;
        $errstr = null;
        if ( $this->options->connectionType !== self::CONNECTION_PLAIN &&
             !ezcBaseFeatures::hasExtensionSupport( 'openssl' ) )
        {
            throw new ezcBaseExtensionNotFoundException( 'openssl', null, "PHP not configured --with-openssl." );
        }
        if ( count( $this->options->connectionOptions ) > 0 )
        {
            $context = stream_context_create( $this->options->connectionOptions );
            $this->connection = @stream_socket_client( "{$this->options->connectionType}://{$this->serverHost}:{$this->serverPort}",
                                                       $errno, $errstr, $this->options->timeout, STREAM_CLIENT_CONNECT, $context );
        }
        else
        {
            $this->connection = @stream_socket_client( "{$this->options->connectionType}://{$this->serverHost}:{$this->serverPort}",
                                                       $errno, $errstr, $this->options->timeout );
        }

        if ( is_resource( $this->connection ) )
        {
            stream_set_timeout( $this->connection, $this->options->timeout );
            $this->status = self::STATUS_CONNECTED;
            $greeting = $this->getData();
            $this->login();
        }
        else
        {
            throw new ezcMailTransportSmtpException( "Failed to connect to the smtp server: {$this->serverHost}:{$this->serverPort}." );
        }
    }
protected function connect()
    {
        $errno = null;
        $errstr = null;
        if ( $this->options->connectionType !== self::CONNECTION_PLAIN &&
             !ezcBaseFeatures::hasExtensionSupport( 'openssl' ) )
        {
            throw new ezcBaseExtensionNotFoundException( 'openssl', null, "PHP not configured --with-openssl." );
        }
        if ( count( $this->options->connectionOptions ) > 0 )
        {
            $context = stream_context_create( $this->options->connectionOptions );
            $this->connection = @stream_socket_client( "{$this->options->connectionType}://{$this->serverHost}:{$this->serverPort}",
                                                       $errno, $errstr, $this->options->timeout, STREAM_CLIENT_CONNECT, $context );
        }
        else
        {
            $this->connection = @stream_socket_client( "{$this->options->connectionType}://{$this->serverHost}:{$this->serverPort}",
                                                       $errno, $errstr, $this->options->timeout );
        }

        if ( is_resource( $this->connection ) )
        {
            stream_set_timeout( $this->connection, $this->options->timeout );
            $this->status = self::STATUS_CONNECTED;
            $greeting = $this->getData();
            $this->login();
        }
        else
        {
            throw new ezcMailTransportSmtpException( "Failed to connect to the smtp server: {$this->serverHost}:{$this->serverPort}." );
        }
    }
protected function connect ( ) { $ errno = null ; $ errstr = null ; if ( $ this -> options -> connectionType !== self :: CONNECTION_PLAIN && ! ezcBaseFeatures :: hasExtensionSupport ( 'openssl' ) ) { throw new ezcBaseExtensionNotFoundException ( 'openssl' , null , "PHP not configured --with-openssl." ) ; } if ( count ( $ this -> options -> connectionOptions ) > 0 ) { $ context = stream_context_create ( $ this -> options -> connectionOptions ) ; $ this -> connection = @ stream_socket_client ( "{$this->options->connectionType}://{$this->serverHost}:{$this->serverPort}" , $ errno , $ errstr , $ this -> options -> timeout , STREAM_CLIENT_CONNECT , $ context ) ; } else { $ this -> connection = @ stream_socket_client ( "{$this->options->connectionType}://{$this->serverHost}:{$this->serverPort}" , $ errno , $ errstr , $ this -> options -> timeout ) ; } if ( is_resource ( $ this -> connection ) ) { stream_set_timeout ( $ this -> connection , $ this -> options -> timeout ) ; $ this -> status = self :: STATUS_CONNECTED ; $ greeting = $ this -> getData ( ) ; $ this -> login ( ) ; } else { throw new ezcMailTransportSmtpException ( "Failed to connect to the smtp server: {$this->serverHost}:{$this->serverPort}." ) ; } }
Creates a connection to the SMTP server and initiates the login
procedure.

@todo The @ should be removed when PHP doesn't throw warnings for connect problems

@throws ezcMailTransportSmtpException
if no connection could be made
or if the login failed
@throws ezcBaseExtensionNotFoundException
if trying to use SSL and the openssl extension is not installed
Creates a connection to the SMTP server and initiates the login procedure .