1. public function testEmail() {
  2.         $this->SwiftMailer->smtpHost = 'smtp.gmail.com';
  3.         $this->SwiftMailer->smtpPort = 465;
  4.         $this->SwiftMailer->smtpUsername = 'mlrepemi@gmail.com';
  5.         $this->SwiftMailer->smtpPassword = 'secret_password';
  6.        
  7.         $this->SwiftMailer->sendAs = 'html';
  8.         $this->SwiftMailer->from = 'reynierpm@gmail.com';
  9.         $this->SwiftMailer->fromName = 'New bakery component';
  10.         $this->SwiftMailer->to = 'reynierpm@gmail.com';
  11.        
  12.         //set variables to template as usual
  13.         $this->set('message', 'My message');
  14.          
  15.         try {
  16.             if(!$this->SwiftMailer->send('default', 'My subject')) {
  17.                 $this->log("Error sending email");
  18.             }
  19.         }
  20.         catch(Exception $e) {
  21.             $this->log("Failed to send email: ".$e->getMessage());
  22.         }
  23.        
  24.         $this->redirect($this->referer(), null, true);
  25.        
  26. //      $email = new CakeEmail();
  27. //      $email->from(array('reynierpm@gmail.com' => __('Recruitment Job App')))
  28. //      ->to('reynierpm@gmail.com')
  29. //      ->subject(__('Recruitment Status Update'))
  30. //      ->send(__('Dear, ReynierPM this is a testing email'));
  31.     }