I need to send two different emails one for the admin and the other email is a confirmation email for the user to confirm that we have received his request. I don't know how can I exactly send different emails to different email addresses in the same action in cakephp.
Code :
Controller
$Email = new CakeEmail('notifications');
$result = $Email->to(array('[email protected]'))
->subject(__("Request Notification))
->send($message);
if($result){
$this->redirect('/pages/thankyou');
$companymsg= "Dear,Thank you for you interest we will contact you soon."
$Email = new CakeEmail('usernotifications');
$Email->to(array($email))
->subject(__(" Request"))
->send($companymsg);
}
Email Configuration
public $notifications = array(
'transport' => 'Mail',
'from' => array('[email protected]' => '(Notification)'),
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
'emailFormat' => 'html',
);
public $usernotifications = array(
'transport' => 'Mail',
'from' => array('[email protected]' => 'My Project'),
'charset' => 'utf-8',
'headerCharset' => 'utf-8',
'emailFormat' => 'html',
);