提问前请务必仔细阅读 如何排查故障 和 常见问题。
问题描述:
配置邮箱发送直接提示错误。使用的是QQ企业邮,经验证可以发。
报错内容:
Oops! Something went wrong. Please reload the page and try again.
logs日志如下:
调试模式报错内容:
[2023-06-02 15:48:07] flarum.ERROR: Swift_TransportException: Connection could not be established with host smtp.exmail.qq.com :Undefined variable: errno in /data/user/htdocs/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php:261
Stack trace:
#0 /data/user/htdocs/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(264): Swift_Transport_StreamBuffer->{closure}(8, ‘Undefined varia…’, ‘/data/user/htdo…’, 264, Array)
#1 /data/user/htdocs/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(58): Swift_Transport_StreamBuffer->establishSocketConnection()
#2 /data/user/htdocs/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(143): Swift_Transport_StreamBuffer->initialize(Array)
#3 /data/user/htdocs/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(65): Swift_Transport_AbstractSmtpTransport->start()
#4 /data/user/htdocs/vendor/illuminate/mail/Mailer.php(521): Swift_Mailer->send(Object(Swift_Message), Array)
#5 /data/user/htdocs/vendor/illuminate/mail/Mailer.php(288): Illuminate\Mail\Mailer->sendSwiftMessage(Object(Swift_Message))
#6 /data/user/htdocs/vendor/illuminate/mail/Mailer.php(212): Illuminate\Mail\Mailer->send(NULL, Array, Object(Closure))
#7 /data/user/htdocs/vendor/flarum/core/src/Api/Controller/SendTestMailController.php(43): Illuminate\Mail\Mailer->raw(‘Hey Irong!\n\nThi…’, Object(Closure))
#8 /data/user/htdocs/vendor/flarum/core/src/Http/RouteHandlerFactory.php(41): Flarum\Api\Controller\SendTestMailController->handle(Object(Laminas\Diactoros\ServerRequest))
#9 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/ExecuteRoute.php(27): Flarum\Http\RouteHandlerFactory->Flarum\Http{closure}(Object(Laminas\Diactoros\ServerRequest), Array)
#10 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ExecuteRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Closure))
#11 /data/user/htdocs/vendor/flarum/core/src/Api/Middleware/ThrottleApi.php(33): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#12 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\ThrottleApi->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#13 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(44): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#14 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#15 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/ResolveRoute.php(69): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#16 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ResolveRoute->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#17 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/SetLocale.php(51): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#18 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\SetLocale->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#19 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(58): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#20 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithHeader->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#21 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(31): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#22 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#23 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(52): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#24 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\RememberFromCookie->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#25 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/StartSession.php(61): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#26 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\StartSession->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#27 /data/user/htdocs/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(29): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#28 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Api\Middleware\FakeHttpMethods->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#29 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(28): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#30 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ParseJsonBody->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#31 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(57): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#32 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\HandleErrors->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#33 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/InjectActorReference.php(25): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#34 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\InjectActorReference->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#35 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#36 /data/user/htdocs/vendor/middlewares/request-handler/src/RequestHandler.php(84): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#37 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\RequestHandler->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#38 /data/user/htdocs/vendor/middlewares/base-path-router/src/BasePathRouter.php(101): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#39 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePathRouter->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#40 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Middleware/OriginalMessages.php(36): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#41 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Laminas\Stratigility\Middleware\OriginalMessages->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#42 /data/user/htdocs/vendor/middlewares/base-path/src/BasePath.php(73): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#43 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Middlewares\BasePath->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#44 /data/user/htdocs/vendor/flarum/core/src/Http/Middleware/ProcessIp.php(24): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#45 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/Next.php(49): Flarum\Http\Middleware\ProcessIp->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\Next))
#46 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(75): Laminas\Stratigility\Next->handle(Object(Laminas\Diactoros\ServerRequest))
#47 /data/user/htdocs/vendor/laminas/laminas-stratigility/src/MiddlewarePipe.php(64): Laminas\Stratigility\MiddlewarePipe->process(Object(Laminas\Diactoros\ServerRequest), Object(Laminas\Stratigility\EmptyPipelineHandler))
#48 /data/user/htdocs/vendor/laminas/laminas-httphandlerrunner/src/RequestHandlerRunner.php(96): Laminas\Stratigility\MiddlewarePipe->handle(Object(Laminas\Diactoros\ServerRequest))
#49 /data/user/htdocs/vendor/flarum/core/src/Http/Server.php(45): Laminas\HttpHandlerRunner\RequestHandlerRunner->run()
#50 /data/user/htdocs/index.php(26): Flarum\Http\Server->listen()
#51 {main}
已尝试的解决办法:
另外找服务器部署了本地的,相同的配置功能,邮件能发出。不同地在于:本地测试的是在public下,云虚拟机,把文件从public里移出来了。
网址: