Performs CRAM-MD5 authentication

Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT

package Default
inherited_from \Zend\Mail\Protocol\Smtp

 Methods

Constructor.

__construct(string|array $host = '127.0.0.1', null|integer $port = null, null|array $config = null

All parameters may be passed as an array to the first argument of the constructor. If so,

inherited_from \Zend\Mail\Protocol\Smtp::__construct()

Parameters

$host

stringarray

(Default: 127.0.0.1)

$port

nullinteger

(Default: null)

$config

nullarray

Auth-specific parameters

Constructor.

__construct(string $host = '127.0.0.1', integer $port = null
Inherited

Parameters

$host

string

OPTIONAL Hostname of remote connection (default: 127.0.0.1)

$port

integer

OPTIONAL Port number (default: null)

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Class destructor to cleanup open resources

__destruct() 
Inherited

Performs CRAM-MD5 authentication with supplied credentials

auth() 

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

inherited_from \Zend\Mail\Protocol\Smtp::auth()

Default authentication method

auth() 
Inherited

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

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Create a connection to the remote host

connect() 
Inherited

Concrete adapters for this class will implement their own unique connect scripts, using the _connect() method to create the socket resource.

Issues DATA command

data(string $data) 
Inherited

Parameters

$data

string

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Closes connection

disconnect() 
Inherited

Retrieve the transaction log

getLog() : string
Inherited

Returns

string

Get the maximum log size

getMaximumLog() : integer
Inherited

Returns

integerthe maximum log size

Get password

getPassword() : string

Returns

string

Retrieve the last client request

getRequest() : string
Inherited

Returns

string

Retrieve the last server response

getResponse() : array
Inherited

Returns

array

Get username

getUsername() : string

Returns

string

Returns the perceived session status

hasSession() : boolean
Inherited

Returns

boolean

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

helo(string $host = '127.0.0.1'
Inherited

Parameters

$host

string

The client hostname or IP address (default: 127.0.0.1)

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Issues MAIL command

mail(string $from) 
Inherited

Parameters

$from

string

Sender mailbox

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Issues the NOOP command end validates answer

noop() 
Inherited

Not used by Zend\Mail, could be used to keep a connection alive or check if it is still open.

Issues the QUIT command and clears the current session

quit() 
Inherited

Issues RCPT command

rcpt(string $to) 
Inherited

Parameters

$to

string

Receiver(s) mailbox

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Reset the transaction log

resetLog() 
Inherited

Issues the RSET command end validates answer

rset() 
Inherited

Can be used to restore a clean smtp communication state when a transaction has been cancelled or commencing a new transaction.

Set the maximum log size

setMaximumLog(integer $maximumLog) 
Inherited

Parameters

$maximumLog

integer

Maximum log size

Set value for password

setPassword(string $password) : \Zend\Mail\Protocol\Smtp\Auth\Crammd5

Parameters

$password

string

Returns

\Zend\Mail\Protocol\Smtp\Auth\Crammd5

Set value for username

setUsername(string $username) : \Zend\Mail\Protocol\Smtp\Auth\Crammd5

Parameters

$username

string

Returns

\Zend\Mail\Protocol\Smtp\Auth\Crammd5

Issues the VRFY command end validates answer

vrfy(string $user) 
Inherited

Not used by Zend\Mail.

Parameters

$user

string

User Name or eMail to verify

Add the transaction log

_addLog(string $value) 
Inherited

Parameters

$value

string

new transaction

Connect to the server using the supplied transport and target

_connect(string $remote) : boolean
Inherited

An example $remote string may be 'tcp://mail.example.com:25' or 'ssh://hostname.com:2222'

Parameters

$remote

string

Remote

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

boolean

Disconnect from remote host and free resource

_disconnect() 
Inherited

Send EHLO or HELO depending on capabilities of smtp host

_ehlo(string $host) 
Inherited

Parameters

$host

string

The client hostname or IP address (default: 127.0.0.1)

Exceptions

\Exception\Zend\Mail\Protocol\Exception\ExceptionInterface

Parse server response for successful codes

_expect(string|array $code, integer $timeout = null) : string
Inherited

Read the response from the stream and check for expected return code. Throws a Zend\Mail\Protocol\Exception\ExceptionInterface if an unexpected code is returned.

Parameters

$code

stringarray

One or more codes that indicate a successful response

$timeout

integer

Per-request timeout value if applicable

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

stringLast line of response string

Prepare CRAM-MD5 response to server's ticket

_hmacMd5(string $key, string $data, integer $block = 64) : string

Parameters

$key

string

Challenge key (usually password)

$data

string

Challenge data

$block

integer

Length of blocks (deprecated; unused)

Returns

string

Get a line from the stream.

_receive(integer $timeout = null) : string
Inherited

Parameters

$timeout

integer

Per-request timeout value if applicable

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

string

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

_send(string $request) : integer | boolean
Inherited

Parameters

$request

string

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

integerbooleanNumber of bytes written to remote host

Start mail session

_startSession() 
Inherited

Stop mail session

_stopSession() 
Inherited

 Properties

 

Indicates an smtp AUTH has been issued and authenticated

$auth : boolean

Default

false
 

Indicates that DATA has been issued and sent

$data : boolean

Default

null
 

Hostname or IP address of remote server

$host : string

Default

 

Indicates a MAIL command has been issued

$mail : boolean

Default

false
 

Maximum of the transaction log

$maximumLog : integer

Default

64
 

$password

$password : string

Default

 

Port number of connection

$port : integer

Default

 

Indicates one or more RCTP commands have been issued

$rcpt : boolean

Default

false
 

Last request sent to server

$request : string

Default

 

Array of server responses to last request

$response : array

Default

 

Indicates that a session is requested to be secure

$secure : string

Default

 

Indicates an smtp session has been started by the HELO command

$sess : boolean

Default

false
 

Socket connection resource

$socket : resource

Default

 

The transport method for the socket

$transport : string

Default

'tcp'
 

$username

$username : string

Default

 

Instance of Zend\Validator\ValidatorChain to check hostnames

$validHost : \Zend\Validator\ValidatorChain

Default

 

Log of mail requests and server responses for a session

$log : array

Default

array()

 Constants

 

Mail default EOL string

EOL = "\r\n" 
 

Default timeout in seconds for initiating session

TIMEOUT_CONNECTION = 30