Minimum implementation according to RFC2821: EHLO, MAIL FROM, RCPT TO, DATA, RSET, NOOP, QUIT
Methods
Constructor.
__construct(string $host, int $port, array $config)
The first argument may be an array of all options. If so, it must include
the 'host' and 'port' keys in order to ensure that all required values
are present.
Parameters
$host
string
(Default: 127.0.0.1)
$config
array
Auth-specific parameters
Exceptions
Class destructor to cleanup open resources
__destruct()
Inherited
inherited_from |
\Zend\Mail\Protocol\AbstractProtocol::__destruct() |
inherited_from |
\Zend\Mail\Protocol\Smtp::__destruct() |
Perform PLAIN authentication with supplied credentials
auth()
This default method is implemented by AUTH adapters to properly authenticate to a remote host.
Exceptions
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
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
int
the maximum log size
Get password
getPassword() : 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 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
Issues MAIL command
mail(string $from)
Inherited
inherited_from |
\Zend\Mail\Protocol\Smtp::mail() |
Parameters
$from
string
Sender mailbox
Exceptions
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
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
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
Exceptions
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
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
Returns
string
Last line of response 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
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
Returns
int
bool
Number 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 |
PLAIN 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 |
PLAIN 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 |