Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
getCryptoMethod example
throw
new
Zend_Mail_Protocol_Exception
(
join
(
', ',
$this
->_validHost->
getMessages
(
)
)
)
;
}
// Initiate helo sequence
$this
->
_expect
(
220, 300
)
; // Timeout set for 5 minutes as per RFC 2821 4.5.3.2
$this
->
_ehlo
(
$host
)
;
// If a TLS session is required, commence negotiation
if
(
$this
->_secure == 'tls'
)
{
$this
->
_send
(
'STARTTLS'
)
;
$this
->
_expect
(
220, 180
)
;
if
(
!
stream_socket_enable_crypto
(
$this
->_socket, true,
$this
->
getCryptoMethod
(
)
)
)
{
/** * @see Zend_Mail_Protocol_Exception */
throw
new
Zend_Mail_Protocol_Exception
(
'Unable to connect via TLS'
)
;
}
$this
->
_ehlo
(
$host
)
;
}
$this
->
_startSession
(
)
;
$this
->
auth
(
)
;
}
if
(
!
$this
->
_assumedNextLine
(
'* OK'
)
)
{
/** * @see Zend_Mail_Protocol_Exception */
throw
new
Zend_Mail_Protocol_Exception
(
'host doesn\'t allow connection'
)
;
}
if
(
$ssl
=== 'TLS'
)
{
$result
=
$this
->
requestAndResponse
(
'STARTTLS'
)
;
$result
=
$result
&&
stream_socket_enable_crypto
(
$this
->_socket, true,
$this
->
getCryptoMethod
(
)
)
;
if
(
!
$result
)
{
/** * @see Zend_Mail_Protocol_Exception */
throw
new
Zend_Mail_Protocol_Exception
(
'cannot enable TLS'
)
;
}
}
}
/** * get the next line from socket with error checking, but nothing else * * @return string next line * @throws Zend_Mail_Protocol_Exception */
strtok
(
$welcome
, '<'
)
;
$this
->_timestamp =
strtok
(
'>'
)
;
if
(
!
strpos
(
$this
->_timestamp, '@'
)
)
{
$this
->_timestamp = null;
}
else
{
$this
->_timestamp = '<' .
$this
->_timestamp . '>';
}
if
(
$ssl
=== 'TLS'
)
{
$this
->
request
(
'STLS'
)
;
$result
=
stream_socket_enable_crypto
(
$this
->_socket, true,
$this
->
getCryptoMethod
(
)
)
;
if
(
!
$result
)
{
/** * @see Zend_Mail_Protocol_Exception */
throw
new
Zend_Mail_Protocol_Exception
(
'cannot enable TLS'
)
;
}
}
return
$welcome
;
}