How to setup email accounts in cakephp

We all have to know that, there are need to use one dynamic setting by which we can setup in one file though which we can manage all email which are sending from our site.

1) An Cakephp have use email.php file which is located in ‘app/config/’ folder, to setup email accounts.

2) An cakephp have to use CakeEmail Helper to send email and its easy to use just use following line of codes in your controller,

App::uses(‘CakeEmail’, ‘Network/Email’);

$email = new CakeEmail(‘demo1’);





$email->send(‘content of email like “HTML”‘);

3) Also we have to setup ‘demo1’ account in email.php file, which have the following configuration,

public $demo1 = array(
‘transport’ => ‘Mail’,    //If you use smtp then add “Smtp” instead of “Mail”
‘host’ => ‘Your host name which created in cpanel email accounts  like “”‘,
‘from’ => array(‘’ => ‘This is Notification’),
‘timeout’ => 90,
‘port’ => 587,
‘username’ => ‘enter “Username” for that email account in cpanel’,
‘password’ => ‘enter “Password” for that email account in cpanel’,
‘log’ => true

4) About the above configuration, when you use step-2 code in controller and add “demo1” account in that then all the email in that controller and that action use that “demo1” account email setup and send from “” and also authenticate by its username and password.

5) You can make many more account like that “demo1”, “demo2″… etc.