我正在使用cakephp 3.x.电子邮件在localhost中正常工作,但在实时服务器的情况下不能正常工作。它同时给出错误,如“传输类”SMTP“未找到”。我已经被困了很长时间。请为它提供良好的解决方案。为什么会发生这种情况,我该怎么办?这是我的配置/应用页面
'EmailTransport' => [
'default' => [
'className' => 'SMTP',
// The following keys are used in SMTP transports
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'timeout' => 30,
'username' => 'mardshehenshah@gmail.com',
'password' => '*******',
// 'client' => null,
// 'tls' => null,
// 'url' => env('EMAIL_TRANSPORT_DEFAULT_URL', null),
],
],
'Email' => [
'default' => [
'transport' => 'default',
'from' => 'you@localhost',
//'charset' => 'utf-8',
//'headerCharset' => 'utf-8',
],
],
这是我的控制器:
$email = new Email('default');
$email->from(['Abc@gmail.com' => 'Model Broucher Information'])
->emailFormat('html')
->to($emailAddRess)
->subject('About')
->send($msg);