public function testEmail() { $this->SwiftMailer->smtpHost = 'smtp.gmail.com'; $this->SwiftMailer->smtpPort = 465; $this->SwiftMailer->smtpUsername = 'mlrepemi@gmail.com'; $this->SwiftMailer->smtpPassword = 'secret_password'; $this->SwiftMailer->sendAs = 'html'; $this->SwiftMailer->from = 'reynierpm@gmail.com'; $this->SwiftMailer->fromName = 'New bakery component'; $this->SwiftMailer->to = 'reynierpm@gmail.com'; //set variables to template as usual $this->set('message', 'My message'); try { if(!$this->SwiftMailer->send('default', 'My subject')) { $this->log("Error sending email"); } } catch(Exception $e) { $this->log("Failed to send email: ".$e->getMessage()); } $this->redirect($this->referer(), null, true); // $email = new CakeEmail(); // $email->from(array('reynierpm@gmail.com' => __('Recruitment Job App'))) // ->to('reynierpm@gmail.com') // ->subject(__('Recruitment Status Update')) // ->send(__('Dear, ReynierPM this is a testing email')); }