Performs CRAM-MD5 authentication

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

 Methods

Constructor.

__construct(string | array $host, null | int $port, null | array $config) 

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

Parameters

$host

stringarray

(Default: 127.0.0.1)

$port

nullint

(Default: null)

$config

nullarray

Auth-specific parameters

Exceptions

\Zend\Mail\Protocol\Exception\InvalidArgumentException

Class destructor to cleanup open resources

__destruct() 
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::__destruct()
inherited_from \Zend\Mail\Protocol\Smtp::__destruct()

Performs CRAM-MD5 authentication with supplied credentials

auth() 

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

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Connect to the server with the parameters given in the constructor.

connect() : bool
Inherited

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

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

Returns

bool

Issues DATA command

data(string $data) 
Inherited

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

Parameters

$data

string

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Closes connection

disconnect() 
Inherited

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

Retrieve the transaction log

getLog() : string
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::getLog()
inherited_from \Zend\Mail\Protocol\Smtp::getLog()

Returns

string

Get the maximum log size

getMaximumLog() : int
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::getMaximumLog()
inherited_from \Zend\Mail\Protocol\Smtp::getMaximumLog()

Returns

intthe maximum log size

Get password

getPassword() : string

Returns

string

Retrieve the last client request

getRequest() : string
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::getRequest()
inherited_from \Zend\Mail\Protocol\Smtp::getRequest()

Returns

string

Retrieve the last server response

getResponse() : array
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::getResponse()
inherited_from \Zend\Mail\Protocol\Smtp::getResponse()

Returns

array

Get username

getUsername() : string

Returns

string

Returns the perceived session status

hasSession() : bool
Inherited

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

Returns

bool

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

helo(string $host) 
Inherited

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

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

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

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.

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

Issues the QUIT command and clears the current session

quit() 
Inherited

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

Issues RCPT command

rcpt(string $to) 
Inherited

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

Parameters

$to

string

Receiver(s) mailbox

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Reset the transaction log

resetLog() 
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::resetLog()
inherited_from \Zend\Mail\Protocol\Smtp::resetLog()

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.

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

Set the maximum log size

setMaximumLog(int $maximumLog) 
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::setMaximumLog()
inherited_from \Zend\Mail\Protocol\Smtp::setMaximumLog()

Parameters

$maximumLog

int

Maximum log size

Set value for password

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

Parameters

$password

string

Returns

Set value for username

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

Parameters

$username

string

Returns

Issues the VRFY command end validates answer

vrfy(string $user) 
Inherited

Not used by Zend\Mail.

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

Parameters

$user

string

User Name or eMail to verify

Add the transaction log

_addLog(string $value) 
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::_addLog()
inherited_from \Zend\Mail\Protocol\Smtp::_addLog()

Parameters

$value

string

new transaction

Connect to the server using the supplied transport and target

_connect(string $remote) : bool
Inherited

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

inherited_from \Zend\Mail\Protocol\AbstractProtocol::_connect()
inherited_from \Zend\Mail\Protocol\Smtp::_connect()

Parameters

$remote

string

Remote

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

bool

Disconnect from remote host and free resource

_disconnect() 
Inherited

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

Send EHLO or HELO depending on capabilities of smtp host

_ehlo(string $host) 
Inherited

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

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, int $timeout) : 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.

inherited_from \Zend\Mail\Protocol\AbstractProtocol::_expect()
inherited_from \Zend\Mail\Protocol\Smtp::_expect()

Parameters

$code

stringarray

One or more codes that indicate a successful response

$timeout

int

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, int $block) : string

Parameters

$key

string

Challenge key (usually password)

$data

string

Challenge data

$block

int

Length of blocks (deprecated; unused)

Returns

string

Get a line from the stream.

_receive(int $timeout) : string
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::_receive()
inherited_from \Zend\Mail\Protocol\Smtp::_receive()

Parameters

$timeout

int

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) : int | bool
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::_send()
inherited_from \Zend\Mail\Protocol\Smtp::_send()

Parameters

$request

string

Exceptions

\Zend\Mail\Protocol\Exception\RuntimeException

Returns

intboolNumber of bytes written to remote host

Start mail session

_startSession() 
Inherited

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

Stop mail session

_stopSession() 
Inherited

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

 Properties

 

Indicates an smtp AUTH has been issued and authenticated

$auth : bool
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$auth
 

Indicates that DATA has been issued and sent

$data : bool
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$data
 

Hostname or IP address of remote server

$host : string
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$host
inherited_from \Zend\Mail\Protocol\Smtp::$$host
 

Indicates a MAIL command has been issued

$mail : bool
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$mail
 

Maximum of the transaction log

$maximumLog : int
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$maximumLog
inherited_from \Zend\Mail\Protocol\Smtp::$$maximumLog
 

$password

$password : string

 

Port number of connection

$port : int
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$port
inherited_from \Zend\Mail\Protocol\Smtp::$$port
 

Indicates one or more RCTP commands have been issued

$rcpt : bool
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$rcpt
 

Last request sent to server

$request : string
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$request
inherited_from \Zend\Mail\Protocol\Smtp::$$request
 

Array of server responses to last request

$response : array
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$response
inherited_from \Zend\Mail\Protocol\Smtp::$$response
 

Indicates that a session is requested to be secure

$secure : string
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$secure
 

Indicates an smtp session has been started by the HELO command

$sess : bool
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$sess
 

Socket connection resource

$socket : resource
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$socket
inherited_from \Zend\Mail\Protocol\Smtp::$$socket
 

The transport method for the socket

$transport : string
Inherited

inherited_from \Zend\Mail\Protocol\Smtp::$$transport
 

$username

$username : string

 

Instance of Zend\Validator\ValidatorChain to check hostnames

$validHost : \Zend\Validator\ValidatorChain
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$validHost
inherited_from \Zend\Mail\Protocol\Smtp::$$validHost
 

Log of mail requests and server responses for a session

$log : array
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::$$log
inherited_from \Zend\Mail\Protocol\Smtp::$$log

 Constants

 

Mail default EOL string

EOL 
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::EOL
inherited_from \Zend\Mail\Protocol\Smtp::EOL
 

Default timeout in seconds for initiating session

TIMEOUT_CONNECTION 
Inherited

inherited_from \Zend\Mail\Protocol\AbstractProtocol::TIMEOUT_CONNECTION
inherited_from \Zend\Mail\Protocol\Smtp::TIMEOUT_CONNECTION