运输类" SMTP"在godaddy中找不到

时间:2018-04-19 03:16:00

标签: cakephp cakephp-3.0

这在我的localhost中工作,但是当我上传到godaddy服务器

传输类" SMTP"找不到

 'EmailTransport' => [
        'default' => [
            'className' => 'SMTP',
            // The following keys are used in SMTP transports
            'host' => 'ssl://smtp.gmail.com',
            'port' => 465,
            'timeout' => 30,
            'username' => 'myemail@gmail.com',
            'password' => 'mypassword',
            'client' => null,
            'tls' => null,

            /************** added code from local**/
             'context' => [
    'ssl' => [
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    ]
  ]
  ],
],

以下是向用户发送通知的代码

**UsersController.php**


**Transport class "SMTP" not found.**

 if($this->Users->save($user)) {

  stack trace =>               $this->getMailer('User')->send('registered', [$user]);

}

1 个答案:

答案 0 :(得分:0)

'EmailTransport' => [
        'default' => [
            'className' => 'Mail',
            // The following keys are used in SMTP transports
            'host' => 'ssl://smtp.gmail.com',
            'port' => 465,
            'timeout' => 30,
            'username' => 'my@gmail.com',
            'password' => 'xxxxxxx',
            'client' => null,
            'tls' => null,

     ],
   ],

如所述here