[英]cakephp email error with SMTP server did not accept the password. Less secure apps is enabled
我正在使用 cakephp4 和我在本地工作的電子郵件,但我的服務器 https 上使用電子郵件的相同代碼給出了 SMTP 服務器的錯誤不接受密碼。 啟用了不太安全的應用程序。 由於代碼相同,我不知道該怎么做。 這適用於我的本地,因為我可以很好地發送電子郵件,但不能在服務器上發送電子郵件?
'gmail3' => [
'host' => 'ssl://smtp.gmail.com',
'port' => 465,
'timeout' => 30,
'username'=>'xx@gmail.com',
'password'=>'xx',
'client' => null,
'className' => 'Smtp',
'context' => [
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
]
]
//sending an email
$Email = new Mailer('default');
$Email->getTransport('gmail3');
$Email->setFrom([$this->from => 'My Email'])
->setTo($to)
->setSubject($subject)
->deliver($message);
如果我在 gmail 中更改為應用程序密碼,那么它確實有效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.