如何修复[SocketException]无法发送电子邮件。 CakePHP出错

I have been trying to get this Email code working in my CakePHP for ages now. It is meant gather data from a simple contact form and send an email to a specific address. For now I am simply trying to get the emailing sending.

When I load the page I get Could not send Email and when I look at the log I get [SocketException] Could not send email.

Also I have used the smtp settings in a different area for a reset password email that does work.

Any help would be greatly appreciated.

Here is my ContactController

<?php
App::uses('AppController', 'Controller');
App::uses('CakeEmail', 'Network/Email');

class ContactController extends AppController {


public function sendEmail() 
   {    
 /*$fname = $_POST['first_name'];
  $lname = $_POST['last_name'];
  $visitor_email = $_POST['email'];
  $telephone = $_POST['telephone']; */
 // $comments = $_POST['comments'];

   $Email = new CakeEmail();
    /* SMTP Options */
                            $Email->smtpOptions = array(
                    'transport' => 'Smtp',
                                'port'=>'465',
                                'timeout'=>'30',
                                'host' => 'ssl://smtp.gmail.com',
                                'username'=>'frankstoncsf@gmail.com',
                                'password'=>'xxxxxxx',
                'log'=>true
                                  );
        $Email->template = 'resetpw';
        $Email->from(array('frankstoncsf@gmail.com' => 'My Site'));
                $Email->to('thomas.chambers5@gmail.com');
                $Email->subject('Reset Your Frankson.net User Password');


                $Email->sendAs = 'both';

                                $Email->delivery = 'Smtp';
                               // $Email->set('ms', 'hello');
                                $Email->send('hello');

                                set('smtp_errors', $Email->smtpError);

 }

public function index() {


    $this->sendEmail();


}

}