Mail/Protocol/Smtp.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: Smtp.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_Mail_Protocol_Smtp
Smtp implementation of Zend_Mail_Protocol_Abstract
Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT
- Parent(s)
- \Zend_Mail_Protocol_Abstract
- Children
- \Zend_Mail_Protocol_Smtp_Auth_Crammd5
- \Zend_Mail_Protocol_Smtp_Auth_Plain
- \Zend_Mail_Protocol_Smtp_Auth_Login
- 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

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


\unknown_type $_auth = false
Indicates an smtp AUTH has been issued and authenticated
false
Details- Type
- \unknown_type


\unknown_type $_data = null
Indicates that DATA has been issued and sent
null
Details- Type
- \unknown_type


\unknown_type $_helo = false
Indicates the HELO command has been issues
false
Details- Type
- \unknown_type


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


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


\unknown_type $_mail = false
Indicates a MAIL command has been issued
false
Details- Type
- \unknown_type


integer $_maximumLog = 64
64
Details- Type
- integer
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_maximumLog


\unknown_type $_rcpt = false
Indicates one or more RCTP commands have been issued
false
Details- Type
- \unknown_type


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


boolean $_sess = false
Indicates an smtp session has been started by the HELO command
false
Details- Type
- boolean


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'%d%s'
Details- Type
- resource
- Inherited_from
- \Zend_Mail_Protocol_Abstract::$$_template


string $_transport = 'tcp'
The transport method for the socket
'tcp'
Details- Type
- string


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


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


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

_connect(string $remote) : boolean
Connect to the server using the supplied transport and target
Inherited from: \Zend_Mail_Protocol_Abstract::_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()

_ehlo(string $host) : void
Send EHLO or HELO depending on capabilities of smtp host
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()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
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()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
Name | Type | Description |
---|---|---|
$timeout | integer |
Type | Description |
---|---|
boolean |


auth() : void
Default authentication method
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.
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
Issues DATA command
Name | Type | Description |
---|---|---|
$data | string |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


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


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


helo(string $host = '127.0.0.1') : void
Initiate HELO/EHLO sequence and set flag to indicate valid smtp session
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
Issues MAIL command
Name | Type | Description |
---|---|---|
$from | string | Sender mailbox |
Exception | Description |
---|---|
\Zend_Mail_Protocol_Exception |


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


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


rset() : void
Issues the RSET command and validates answer
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
Name | Type | Description |
---|---|---|
$maximumLog | integer | Maximum log size |