Cakephp Email Setting

Basic usage
First of all, you should ensure the class is loaded using App::uses():

App::uses('CakeEmail', 'Network/Email');
Using CakeEmail is similar to using EmailComponent. But instead of using attributes you use methods. Example:

$Email = new CakeEmail();
$Email->from(array('' => 'My Site'));
$Email->send('My message');

To enable the transport, add the following information to your Config/email.php:

You can configure SSL SMTP servers such as Gmail. To do so, prefix the host with 'ssl://' and configure the port value accordingly. Example:

class EmailConfig {
    public $gmail = array(
        'host' => 'ssl://',
        'port' => 465,
        'username' => '',
        'password' => 'secret',
        'transport' => 'Smtp'

public $smtp = array(
'transport' => 'Smtp',
//'from' => array('site@localhost' => 'My Site'),
'host' => '',
'timeout' => 30,
'mailgun_domain'    => '',
'client' => null,
'log' => false,
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',

$email = new CakeEmail('smtp');