API Documentation

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 license@zend.com so we can send you a copy immediately.

category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Mail  
subpackage
Protocol  
version
$Id: Smtp.php 23775 2011-03-01 17:25:24Z ralph $  

\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

Extends from
\Zend_Mail_Protocol_Abstract
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_Mail  
subpackage
Protocol  
version
$Id: Abstract.php 23775 2011-03-01 17:25:24Z ralph $  

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
Propertyprotected\unknown_type  $_mail= 'false'

Indicates a MAIL command has been issued

Default valuefalseDetails
Type
\unknown_type
Propertyprotected\unknown_type  $_rcpt= 'false'

Indicates one or more RCTP commands have been issued

Default valuefalseDetails
Type
\unknown_type
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
Propertyprotectedstring  $_transport= 'tcp'

The transport method for the socket

Default valuetcpDetails
Type
string

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

Class destructor to cleanup open resources

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

Add the transaction log

Inherited from: \Zend_Mail_Protocol_Abstract::_addLog()
Parameters
Name Type Description
$value string new transaction
methodprotected_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'

Parameters
Name Type Description
$remote string Remote
Returns
Type Description
boolean
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_disconnect( ) : void

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

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

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

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
integerboolean Number of bytes written to remote host
Throws
Exception Description
\Zend_Mail_Protocol_Exception
methodprotected_setStreamTimeout( integer $timeout ) : boolean

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

Retrieve the transaction log

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

Get the maximum log size

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

Retrieve the last client request

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

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

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

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 DocBlox 0.13.3.