Email 电子邮件组件cakephp

Email 电子邮件组件cakephp,email,cakephp,components,Email,Cakephp,Components,第一次使用电子邮件组件。。。我按照书上的说明做了这个 function sendNewUserMail($id) { $User = $this->User->read(null,$id); $this->Email->to = array('MyEmai@gmail.com'); $this->Email->from = 'MyEmai@gmail.com'; $this->Email->subject = 'W

第一次使用电子邮件组件。。。我按照书上的说明做了这个

function sendNewUserMail($id) {
    $User = $this->User->read(null,$id);
    $this->Email->to = array('MyEmai@gmail.com'); 
    $this->Email->from = 'MyEmai@gmail.com';
    $this->Email->subject = 'Welcome to our really cool thing';
    $this->Email->template = 'simple_message'; 

    $this->Email->sendAs = 'text'; 
    $this->Email->smtpOptions = array(
        'port'=>'465', 
        'timeout'=>'30',
        'auth' => true,
        'host' => 'ssl://smtp.gmail.com',
        'username'=>'MyEmail@gmail.com',
        'password'=>'*********'   
    );
    $this->set('User', $User);
    $this->Email->delivery = 'smtp';
    $this->Email->send();
    $this->set('smtp_errors', $this->Email->smtpError);
 }
我试着运行这个方法,但是什么都没发生。。。我创建了布局、元素,并放置
var$component=array('Email')

我犯了这个错误

找不到套接字传输“ssl”-您忘记启用了吗 当您配置PHP时,它将被删除?:16


顺便说一句,我在家里,所以没有防火墙,没有阻塞等,Gmail smtp需要一个安全的连接,看起来你的PHP配置没有启用ssl。打开php.ini并查找一行

;extension=php_openssl.dll

并取消对其注释(删除;或#),然后重新启动PHP

如果你找不到这样的线路,你可能需要先安装OpenSSL

#extension=openssl.so