Mail/Protocol/Smtp.php

Show: inherited
Table of Contents

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

Package: Zend\Mail\Protocol

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

Constant  EOL = "\r\n"
inherited

Mail default EOL string

Inherited from: \Zend_Mail_Protocol_Abstract::EOL
Constant  TIMEOUT_CONNECTION = 30
inherited

Default timeout in seconds for initiating session

Inherited from: \Zend_Mail_Protocol_Abstract::TIMEOUT_CONNECTION

Properties

Propertyprotected\unknown_type $_auth = false

Indicates an smtp AUTH has been issued and authenticated

Default valuefalseDetails
Type
\unknown_type
Propertyprotected\unknown_type $_data = null

Indicates that DATA has been issued and sent

Default valuenullDetails
Type
\unknown_type
Propertyprotected\unknown_type $_helo = false

Indicates the HELO command has been issues

Default valuefalseDetails
Type
\unknown_type
Propertyprotectedstring $_host =
inherited

Hostname or IP address of remote server

Inherited from: \Zend_Mail_Protocol_Abstract::$$_host
Details
Type
string
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_host  
Propertyprivatearray $_log = array()
inherited

Log of mail requests and server responses for a session

Inherited from: \Zend_Mail_Protocol_Abstract::$$_log
Default valuearray()Details
Type
array
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_log  
Propertyprotected\unknown_type $_mail = false

Indicates a MAIL command has been issued

Default valuefalseDetails
Type
\unknown_type
Propertyprotectedinteger $_maximumLog = 64
inherited

Maximum of the transaction log

Inherited from: \Zend_Mail_Protocol_Abstract::$$_maximumLog
Default value64Details
Type
integer
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_maximumLog  
Propertyprotectedinteger $_port =
inherited

Port number of connection

Inherited from: \Zend_Mail_Protocol_Abstract::$$_port
Details
Type
integer
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_port  
Propertyprotected\unknown_type $_rcpt = false

Indicates one or more RCTP commands have been issued

Default valuefalseDetails
Type
\unknown_type
Propertyprotectedstring $_request =
inherited

Last request sent to server

Inherited from: \Zend_Mail_Protocol_Abstract::$$_request
Details
Type
string
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_request  
Propertyprotectedarray $_response =
inherited

Array of server responses to last request

Inherited from: \Zend_Mail_Protocol_Abstract::$$_response
Details
Type
array
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_response  
Propertyprotectedstring $_secure =

Indicates that a session is requested to be secure

Details
Type
string
Propertyprotectedboolean $_sess = false

Indicates an smtp session has been started by the HELO command

Default valuefalseDetails
Type
boolean
Propertyprotectedresource $_socket =
inherited

Socket connection resource

Inherited from: \Zend_Mail_Protocol_Abstract::$$_socket
Details
Type
resource
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_socket  
Propertyprotectedresource $_template = '%d%s'
inherited

String template for parsing server responses using sscanf (default: 3 digit code and response string)

Inherited from: \Zend_Mail_Protocol_Abstract::$$_template
Default value'%d%s'Details
Type
resource
Inherited_from
\Zend_Mail_Protocol_Abstract::$$_template  
Propertyprotectedstring $_transport = 'tcp'

The transport method for the socket

Default value'tcp'Details
Type
string
Propertyprotected\Zend_Validate $_validHost =
inherited

Instance of Zend_Validate to check hostnames

Inherited from: \Zend_Mail_Protocol_Abstract::$$_validHost

Methods

methodpublic__construct(string $host = '127.0.0.1', integer $port = null, array $config = array()) : void

Constructor.

Parameters
Name Type Description
$host string
$port integer
$config array
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublic__destruct() : void
inherited

Class destructor to cleanup open resources

Inherited from: \Zend_Mail_Protocol_Abstract::__destruct()
methodprotected_addLog(string $value) : void
inherited

Add the transaction log

Inherited from: \Zend_Mail_Protocol_Abstract::_addLog()
Parameters
Name Type Description
$value string

new transaction

methodprotected_connect(string $remote) : boolean
inherited

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'

Parameters
Name Type Description
$remote string

Remote

Returns
Type Description
boolean
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_disconnect() : void
inherited

Disconnect from remote host and free resource

Inherited from: \Zend_Mail_Protocol_Abstract::_disconnect()
methodprotected_ehlo(string $host) : void

Send EHLO or HELO depending on capabilities of smtp host

Parameters
Name Type Description
$host string

The client hostname or IP address (default: 127.0.0.1)

Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_expect(string | array $code,  $timeout = null) : string
inherited

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.

Parameters
Name Type Description
$code string | array

One or more codes that indicate a successful response

$timeout
Returns
Type Description
string Last line of response string
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_receive( $timeout = null) : string
inherited

Get a line from the stream.

Inherited from: \Zend_Mail_Protocol_Abstract::_receive()
Parameters
Name Type Description
$timeout
Returns
Type Description
string
Throws
Exception Description
\Zend_Mail_Protocol_Exception
Details
integer

Per-request timeout value if applicable

methodprotected_send(string $request) : integer | boolean
inherited

Send the given request followed by a LINEEND to the server.

Inherited from: \Zend_Mail_Protocol_Abstract::_send()
Parameters
Name Type Description
$request string
Returns
Type Description
integer | boolean Number of bytes written to remote host
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_setStreamTimeout(integer $timeout) : boolean
inherited

Set stream timeout

Inherited from: \Zend_Mail_Protocol_Abstract::_setStreamTimeout()
Parameters
Name Type Description
$timeout integer
Returns
Type Description
boolean
methodprotected_startSession() : void

Start mail session

methodprotected_stopSession() : void

Stop mail session

methodpublicauth() : void

Default authentication method

This default method is implemented by AUTH adapters to properly authenticate to a remote host.

Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublicconnect() : 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.

Returns
Type Description
boolean
methodpublicdata(string $data) : void

Issues DATA command

Parameters
Name Type Description
$data string
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublicdisconnect() : void

Closes connection

methodpublicgetLog() : string
inherited

Retrieve the transaction log

Inherited from: \Zend_Mail_Protocol_Abstract::getLog()
Returns
Type Description
string
methodpublicgetMaximumLog() : int
inherited

Get the maximum log size

Inherited from: \Zend_Mail_Protocol_Abstract::getMaximumLog()
Returns
Type Description
int the maximum log size
methodpublicgetRequest() : string
inherited

Retrieve the last client request

Inherited from: \Zend_Mail_Protocol_Abstract::getRequest()
Returns
Type Description
string
methodpublicgetResponse() : array
inherited

Retrieve the last server response

Inherited from: \Zend_Mail_Protocol_Abstract::getResponse()
Returns
Type Description
array
methodpublichelo(string $host = '127.0.0.1') : void

Initiate HELO/EHLO sequence and set flag to indicate valid smtp session

Parameters
Name Type Description
$host string

The client hostname or IP address (default: 127.0.0.1)

Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublicmail(string $from) : void

Issues MAIL command

Parameters
Name Type Description
$from string

Sender mailbox

Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublicnoop() : 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.

methodpublicquit() : void

Issues the QUIT command and clears the current session

methodpublicrcpt(string $to) : void

Issues RCPT command

Parameters
Name Type Description
$to string

Receiver(s) mailbox

Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodpublicresetLog() : void
inherited

Reset the transaction log

Inherited from: \Zend_Mail_Protocol_Abstract::resetLog()
methodpublicrset() : 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.

methodpublicsetMaximumLog(integer $maximumLog) : void
inherited

Set the maximum log size

Inherited from: \Zend_Mail_Protocol_Abstract::setMaximumLog()
Parameters
Name Type Description
$maximumLog integer

Maximum log size

methodpublicvrfy(string $user) : void

Issues the VRFY command and validates answer

Not used by Zend_Mail.

Parameters
Name Type Description
$user string

User Name or eMail to verify

Documentation was generated by phpDocumentor 2.0.0a8.