Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
_send 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
(
)
;
/** * @todo Perform CRAM-MD5 authentication with supplied credentials * * @return void */
public
function
auth
(
)
{
// Ensure AUTH has not already been initiated. parent::
auth
(
)
;
$this
->
_send
(
'AUTH CRAM-MD5'
)
;
$challenge
=
$this
->
_expect
(
334
)
;
$challenge
=
base64_decode
(
$challenge
)
;
$digest
=
$this
->
_hmacMd5
(
$this
->_password,
$challenge
)
;
$this
->
_send
(
base64_encode
(
$this
->_username . ' ' .
$digest
)
)
;
$this
->
_expect
(
235
)
;
$this
->_auth = true;
}
/** * Prepare CRAM-MD5 response to server's ticket * * @param string $key Challenge key (usually password) * @param string $data Challenge data * @param string $block Length of blocks * @return string */
/** * Perform LOGIN authentication with supplied credentials * * @return void */
public
function
auth
(
)
{
// Ensure AUTH has not already been initiated. parent::
auth
(
)
;
$this
->
_send
(
'AUTH LOGIN'
)
;
$this
->
_expect
(
334
)
;
$this
->
_send
(
base64_encode
(
$this
->_username
)
)
;
$this
->
_expect
(
334
)
;
$this
->
_send
(
base64_encode
(
$this
->_password
)
)
;
$this
->
_expect
(
235
)
;
$this
->_auth = true;
}
}
/** * Perform PLAIN authentication with supplied credentials * * @return void */
public
function
auth
(
)
{
// Ensure AUTH has not already been initiated. parent::
auth
(
)
;
$this
->
_send
(
'AUTH PLAIN'
)
;
$this
->
_expect
(
334
)
;
$this
->
_send
(
base64_encode
(
"\0" .
$this
->_username . "\0" .
$this
->_password
)
)
;
$this
->
_expect
(
235
)
;
$this
->_auth = true;
}
}