Mail/Protocol/Smtp/Auth/Plain.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Mail
- Subpackage
- Protocol
- Version
- $Id: Plain.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Mail_Protocol_Smtp_Auth_Plain
Performs PLAIN authentication
Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT
- Parent(s)
- \Zend_Mail_Protocol_Smtp < \Zend_Mail_Protocol_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Version
- $Id: Abstract.php 24593 2012-01-05 20:35:02Z matthew $
Constants

EOL
= "\r\n"
Mail default EOL string
Inherited from: \Zend_Mail_Protocol_Abstract::EOL\Zend_Mail_Protocol_Smtp::EOL- Inherited_from
- \Zend_Mail_Protocol_Abstract::EOL
- Inherited_from
- \Zend_Mail_Protocol_Smtp::EOL

TIMEOUT_CONNECTION
= 30
Default timeout in seconds for initiating session
Inherited from: \Zend_Mail_Protocol_Abstract::TIMEOUT_CONNECTION\Zend_Mail_Protocol_Smtp::TIMEOUT_CONNECTION- Inherited_from
- \Zend_Mail_Protocol_Abstract::TIMEOUT_CONNECTION
- Inherited_from
- \Zend_Mail_Protocol_Smtp::TIMEOUT_CONNECTION
Properties


\unknown_type $_auth = false
Indicates an smtp AUTH has been issued and authenticated
Inherited from: \Zend_Mail_Protocol_Smtp::$$_authfalse
Details- Type
- \unknown_type
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_auth


\unknown_type $_data = null
Indicates that DATA has been issued and sent
Inherited from: \Zend_Mail_Protocol_Smtp::$$_datanull
Details- Type
- \unknown_type
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_data


\unknown_type $_helo = false
Indicates the HELO command has been issues
Inherited from: \Zend_Mail_Protocol_Smtp::$$_helofalse
Details- Type
- \unknown_type
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_helo


string $_host =
Hostname or IP address of remote server
Inherited from: \Zend_Mail_Protocol_Abstract::$$_host\Zend_Mail_Protocol_Smtp::$$_host- Type
- string
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_host
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_host


array $_log = array()
Log of mail requests and server responses for a session
Inherited from: \Zend_Mail_Protocol_Abstract::$$_log\Zend_Mail_Protocol_Smtp::$$_logarray()
Details- Type
- array
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_log
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_log


\unknown_type $_mail = false
false
Details- Type
- \unknown_type
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_mail


integer $_maximumLog = 64
Maximum of the transaction log
Inherited from: \Zend_Mail_Protocol_Abstract::$$_maximumLog\Zend_Mail_Protocol_Smtp::$$_maximumLog64
Details- Type
- integer
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_maximumLog
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_maximumLog


integer $_port =
Port number of connection
Inherited from: \Zend_Mail_Protocol_Abstract::$$_port\Zend_Mail_Protocol_Smtp::$$_port- Type
- integer
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_port
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_port


\unknown_type $_rcpt = false
Indicates one or more RCTP commands have been issued
Inherited from: \Zend_Mail_Protocol_Smtp::$$_rcptfalse
Details- Type
- \unknown_type
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_rcpt


string $_request =
Last request sent to server
Inherited from: \Zend_Mail_Protocol_Abstract::$$_request\Zend_Mail_Protocol_Smtp::$$_request- Type
- string
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_request
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_request


array $_response =
Array of server responses to last request
Inherited from: \Zend_Mail_Protocol_Abstract::$$_response\Zend_Mail_Protocol_Smtp::$$_response- Type
- array
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_response
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_response


string $_secure =
Indicates that a session is requested to be secure
Inherited from: \Zend_Mail_Protocol_Smtp::$$_secure- Type
- string
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_secure


boolean $_sess = false
Indicates an smtp session has been started by the HELO command
Inherited from: \Zend_Mail_Protocol_Smtp::$$_sessfalse
Details- Type
- boolean
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_sess


resource $_socket =
Socket connection resource
Inherited from: \Zend_Mail_Protocol_Abstract::$$_socket\Zend_Mail_Protocol_Smtp::$$_socket- Type
- resource
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_socket
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_socket


resource $_template = '%d%s'
String template for parsing server responses using sscanf (default: 3 digit code and response string)
Inherited from: \Zend_Mail_Protocol_Abstract::$$_template\Zend_Mail_Protocol_Smtp::$$_template'%d%s'
Details- Type
- resource
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_template
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_template


string $_transport = 'tcp'
'tcp'
Details- Type
- string
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_transport


\Zend_Validate $_validHost =
Instance of Zend_Validate to check hostnames
Inherited from: \Zend_Mail_Protocol_Abstract::$$_validHost\Zend_Mail_Protocol_Smtp::$$_validHost- Type
- \Zend_Validate
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_validHost
- Inherited_from
- \Zend_Mail_Protocol_Smtp::$$_validHost
Methods


__construct(string $host = '127.0.0.1', int $port = null, array $config = null) : void
Constructor.
Name | Type | Description |
---|---|---|
$host | string | (Default: 127.0.0.1) |
$port | int | (Default: null) |
$config | array | Auth-specific parameters |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


__destruct() : void
Class destructor to cleanup open resources
Inherited from: \Zend_Mail_Protocol_Abstract::__destruct()\Zend_Mail_Protocol_Smtp::__destruct()

_addLog(string $value) : void
Add the transaction log
Inherited from: \Zend_Mail_Protocol_Abstract::_addLog()\Zend_Mail_Protocol_Smtp::_addLog()Name | Type | Description |
---|---|---|
$value | string | new transaction |


_connect(string $remote) : boolean
Connect to the server using the supplied transport and target
Inherited from: \Zend_Mail_Protocol_Abstract::_connect()\Zend_Mail_Protocol_Smtp::_connect()An example $remote string may be 'tcp://mail.example.com:25' or 'ssh://hostname.com:2222'
Name | Type | Description |
---|---|---|
$remote | string | Remote |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


_disconnect() : void
Disconnect from remote host and free resource
Inherited from: \Zend_Mail_Protocol_Abstract::_disconnect()\Zend_Mail_Protocol_Smtp::_disconnect()

_ehlo(string $host) : void
Send EHLO or HELO depending on capabilities of smtp host
Inherited from: \Zend_Mail_Protocol_Smtp::_ehlo()Name | Type | Description |
---|---|---|
$host | string | The client hostname or IP address (default: 127.0.0.1) |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


_expect(string | array $code, $timeout = null) : string
Parse server response for successful codes
Inherited from: \Zend_Mail_Protocol_Abstract::_expect()\Zend_Mail_Protocol_Smtp::_expect()Read the response from the stream and check for expected return code. Throws a Zend_Mail_Protocol_Exception if an unexpected code is returned.
Name | Type | Description |
---|---|---|
$code | string | array | One or more codes that indicate a successful response |
$timeout |
Type | Description |
---|---|
string | Last line of response string |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


_receive( $timeout = null) : string
Get a line from the stream.
Inherited from: \Zend_Mail_Protocol_Abstract::_receive()\Zend_Mail_Protocol_Smtp::_receive()Name | Type | Description |
---|---|---|
$timeout |
Type | Description |
---|---|
string |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |
- integer
Per-request timeout value if applicable


_send(string $request) : integer | boolean
Send the given request followed by a LINEEND to the server.
Inherited from: \Zend_Mail_Protocol_Abstract::_send()\Zend_Mail_Protocol_Smtp::_send()Name | Type | Description |
---|---|---|
$request | string |
Type | Description |
---|---|
integer | boolean | Number of bytes written to remote host |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


_setStreamTimeout(integer $timeout) : boolean
Set stream timeout
Inherited from: \Zend_Mail_Protocol_Abstract::_setStreamTimeout()\Zend_Mail_Protocol_Smtp::_setStreamTimeout()Name | Type | Description |
---|---|---|
$timeout | integer |
Type | Description |
---|---|
boolean |


auth() : void
Perform PLAIN authentication with supplied credentials
This default method is implemented by AUTH adapters to properly authenticate to a remote host.
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


connect() : boolean
Connect to the server with the parameters given in the constructor.
Inherited from: \Zend_Mail_Protocol_Smtp::connect()Concrete adapters for this class will implement their own unique connect scripts, using the _connect() method to create the socket resource.
Type | Description |
---|---|
boolean |


data(string $data) : void
Name | Type | Description |
---|---|---|
$data | string |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


getLog() : string
Retrieve the transaction log
Inherited from: \Zend_Mail_Protocol_Abstract::getLog()\Zend_Mail_Protocol_Smtp::getLog()Type | Description |
---|---|
string |


getMaximumLog() : int
Get the maximum log size
Inherited from: \Zend_Mail_Protocol_Abstract::getMaximumLog()\Zend_Mail_Protocol_Smtp::getMaximumLog()Type | Description |
---|---|
int | the maximum log size |


getRequest() : string
Retrieve the last client request
Inherited from: \Zend_Mail_Protocol_Abstract::getRequest()\Zend_Mail_Protocol_Smtp::getRequest()Type | Description |
---|---|
string |


getResponse() : array
Retrieve the last server response
Inherited from: \Zend_Mail_Protocol_Abstract::getResponse()\Zend_Mail_Protocol_Smtp::getResponse()Type | Description |
---|---|
array |


helo(string $host = '127.0.0.1') : void
Initiate HELO/EHLO sequence and set flag to indicate valid smtp session
Inherited from: \Zend_Mail_Protocol_Smtp::helo()Name | Type | Description |
---|---|---|
$host | string | The client hostname or IP address (default: 127.0.0.1) |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


mail(string $from) : void
Name | Type | Description |
---|---|---|
$from | string | Sender mailbox |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


noop() : void
Issues the NOOP command and validates answer
Inherited from: \Zend_Mail_Protocol_Smtp::noop()Not used by Zend_Mail, could be used to keep a connection alive or check if it is still open.


quit() : void
Issues the QUIT command and clears the current session
Inherited from: \Zend_Mail_Protocol_Smtp::quit()

rcpt(string $to) : void
Name | Type | Description |
---|---|---|
$to | string | Receiver(s) mailbox |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


resetLog() : void
Reset the transaction log
Inherited from: \Zend_Mail_Protocol_Abstract::resetLog()\Zend_Mail_Protocol_Smtp::resetLog()

rset() : void
Issues the RSET command and validates answer
Inherited from: \Zend_Mail_Protocol_Smtp::rset()Can be used to restore a clean smtp communication state when a transaction has been cancelled or commencing a new transaction.


setMaximumLog(integer $maximumLog) : void
Set the maximum log size
Inherited from: \Zend_Mail_Protocol_Abstract::setMaximumLog()\Zend_Mail_Protocol_Smtp::setMaximumLog()Name | Type | Description |
---|---|---|
$maximumLog | integer | Maximum log size |


vrfy(string $user) : void
Issues the VRFY command and validates answer
Inherited from: \Zend_Mail_Protocol_Smtp::vrfy()Not used by Zend_Mail.
Name | Type | Description |
---|---|---|
$user | string | User Name or eMail to verify |