描述:从本地主机发送邮件邮件工作,但从AWS服务器发送邮件不工作,给出下面我提到的错误。
代码:
$options = new SmtpOptions();
$options->setHost('smtp.gmail.com')
->setName('smtp.gmail.com')
->setPort(587)
->setConnectionClass('login')
->setConnectionConfig(array(
'username' => 'user@domain.com',
'password' => '123456789',
'ssl' => 'tls',
'host'=>'333.333.333.333',
'use_complete_quit' => false,
)
);
$transport->setOptions($options);
$res = $transport->send($message);错误:发生错误执行过程中发生错误,请稍后重试。其他信息: Zend\Mail\Protocol\Exception\RuntimeException
文件:
/var/www/vendor/zendframework/zend-mail/src/Protocol/AbstractProtocol.php:348消息:
5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuo
5.7.14 Px2wvtfOrS5wFFQmXT6hEwb6_1qcc1hT6WbEWXyUx_ySCaHzuDAWuVXje2HQlktgHPhwIi
5.7.14 8qrKNzgRYBckbmSR5J6_w5JDU5MJHcE-dHh718s0BTmxnsRPpHm970TwgImXzT> Please
5.7.14 log in via your web browser and then try again.
5.7.14 Learn more at
5.7.14 https://support.google.com/mail/answer/78754 a9sm10567779iod.76 - gsmtp堆栈跟踪:
#0 /var/www/vendor/zendframework/zend-mail/src/Protocol/Smtp/Auth/Login.php(78): Zend\Mail\Protocol\AbstractProtocol->_expect(Array)
#1 /var/www/vendor/zendframework/zend-mail/src/Protocol/Smtp.php(222): Zend\Mail\Protocol\Smtp\Auth\Login->auth()
#2 /var/www/vendor/zendframework/zend-mail/src/Transport/Smtp.php(401): Zend\Mail\Protocol\Smtp->helo('smtp.gmail.com')
#3 /var/www/vendor/zendframework/zend-mail/src/Transport/Smtp.php(383): Zend\Mail\Transport\Smtp->connect()
#4 /var/www/vendor/zendframework/zend-mail/src/Transport/Smtp.php(394): Zend\Mail\Transport\Smtp->lazyLoadConnection()
#5 /var/www/vendor/zendframework/zend-mail/src/Transport/Smtp.php(251): Zend\Mail\Transport\Smtp->connect()
#6 /var/www/module/Application/src/Controller/PurchaseController.php(785): Zend\Mail\Transport\Smtp->send(Object(Zend\Mail\Message))
#7 /var/www/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(78): Application\Controller\PurchaseController->orderPlaceAction()
#8 /var/www/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#9 /var/www/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#10 /var/www/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(106): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#11 /var/www/vendor/zendframework/zend-mvc/src/DispatchListener.php(138): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#12 /var/www/vendor/zendframework/zend-eventmanager/src/EventManager.php(322): Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#13 /var/www/vendor/zendframework/zend-eventmanager/src/EventManager.php(179): Zend\EventManager\EventManager->triggerListeners(Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /var/www/vendor/zendframework/zend-mvc/src/Application.php(332): Zend\EventManager\EventManager->triggerEventUntil(Object(Closure), Object(Zend\Mvc\MvcEvent))
#15 /var/www/html/index.php(54): Zend\Mvc\Application->run()
#16 {main}发布于 2019-08-19 22:26:35
如果你查看谷歌的support page for error code 78754,他们提到了几个可能的问题。
如果您确定您的邮件和密码,请确保您的请求不是太频繁。他们说你的请求不应该超过10分钟。
此外,如果你使用两步验证,你将需要创建基于应用程序的密码,否则你将不得不使用oAuth来访问gmail。
我建议你也读一下这篇this article。
https://stackoverflow.com/questions/57534885
复制相似问题