Category Covered

Send mail in cakephp2

If you want to send mail using cakephp 2.x version then this tutorial will help you.

Add the following line

App::uses('CakeEmail', 'Network/Email');


Use the following code on your function


$email = new CakeEmail();

$email->from(array('noreply@'.env('SERVER_NAME') => 'Sales Tracking Software'));


$email->subject('Reset password Mail');



$email->viewVars(array('password' => $new_passwor));

return $email->send();


I have two ctp file named recoverpassword.ctp inside views folder where we will design the email. On that ctp file i can use the variable name "password" as i set this.