Send mail using SMTP protocol
$_content
protected array
$_defaultConfig
protected array
$_lastResponse
protected array
$_socket
protected 'code' => 'message'
format. from
email address. MAIL FROM
SMTP command. RCPT TO
SMTP command. __destruct( )
Destructor
Tries to disconnect to ensure that the connection is being terminated properly before the socket gets closed.
_bufferResponseLines( array $responseLines )
Parses and stores the response lines in 'code' => 'message'
format.
$responseLines
_connect( )
Connect to SMTP Server
Cake\Network\Exception\SocketException
_disconnect( )
Disconnect
Cake\Network\Exception\SocketException
_generateSocket( )
Helper method to generate socket
Cake\Network\Exception\SocketException
_prepareFromAddress( Cake\Mailer\Email $email )
Prepares the from
email address.
Cake\Mailer\Email
$email
_prepareFromCmd( string $email )
Prepares the MAIL FROM
SMTP command.
$email
_prepareMessage( Cake\Mailer\Email $email )
Prepares the message body.
Cake\Mailer\Email
$email
_prepareMessageHeaders( Cake\Mailer\Email $email )
Prepares the message headers.
Cake\Mailer\Email
$email
_prepareRcptCmd( string $email )
Prepares the RCPT TO
SMTP command.
$email
_prepareRecipientAddresses( Cake\Mailer\Email $email )
Prepares the recipient email addresses.
Cake\Mailer\Email
$email
_sendData( Cake\Mailer\Email $email )
Send Data
Cake\Mailer\Email
$email
Cake\Network\Exception\SocketException
_sendRcpt( Cake\Mailer\Email $email )
Send emails
Cake\Mailer\Email
$email
Cake\Network\Exception\SocketException
_smtpSend( string|null $data , string|boolean $checkCode '250' )
Protected method for sending data to SMTP connection
$data
$checkCode
optional '250' Cake\Network\Exception\SocketException
connect( )
Connect to the SMTP server.
This method tries to connect only in case there is no open connection available already.
connected( )
Check whether an open connection to the SMTP server is available.
disconnect( )
Disconnect from the SMTP server.
This method tries to disconnect only in case there is an open connection available.
getLastResponse( )
Returns the response of the last sent SMTP command.
A response consists of one or more lines containing a response code and an optional response message text:
[ [ 'code' => '250', 'message' => 'mail.example.com' ], [ 'code' => '250', 'message' => 'PIPELINING' ], [ 'code' => '250', 'message' => '8BITMIME' ], // etc... ]
send( Cake\Mailer\Email $email )
Send mail
Cake\Mailer\Email
$email
Cake\Network\Exception\SocketException
__construct( array $config [] )
Constructor
$config
optional [] _headersToString( array $headers , string $eol "\r\n" )
Help to convert headers in string
$headers
$eol
optional "\r\n" _configDelete( string $key )
Deletes a single config key.
$key
Cake\Core\Exception\Exception
_configRead( string|null $key )
Reads a config key.
$key
_configWrite( string|array $key , mixed $value , boolean|string $merge false )
Writes a config key.
$key
$value
$merge
optional false True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false.
Cake\Core\Exception\Exception
config( string|array|null $key null , mixed|null $value null , boolean $merge true )
Gets/Sets the config.
Reading the whole config:
$this->config();
Reading a specific value:
$this->config('key');
Reading a nested value:
$this->config('some.nested.key');
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key
optional null $value
optional null $merge
optional true Cake\Core\Exception\Exception
configShallow( string|array $key , mixed|null $value null )
Merge provided config with existing config. Unlike config()
which does a recursive merge for nested keys, this method does a simple merge.
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key
$value
optional null getConfig( string|null $key null )
Returns the config.
Reading the whole config:
$this->getConfig();
Reading a specific value:
$this->getConfig('key');
Reading a nested value:
$this->getConfig('some.nested.key');
$key
optional null setConfig( string|array $key , mixed|null $value null , boolean $merge true )
Sets the config.
Setting a specific value:
$this->setConfig('key', $value);
Setting a nested value:
$this->setConfig('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->setConfig(['one' => 'value', 'another' => 'value']);
$key
$value
optional null $merge
optional true Cake\Core\Exception\Exception
protected array
Default config for this class
[ 'host' => 'localhost', 'port' => 25, 'timeout' => 30, 'username' => null, 'password' => null, 'client' => null, 'tls' => false, 'keepAlive' => false ]
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.Mailer.Transport.SmtpTransport.html