Laravel发送邮件报错

发布于 2022-09-06 04:26:24 字数 11855 浏览 18 评论 0

项目在本地,在国外亚马逊云服务器上均可运行,但在国内的阿里云上却报错,错误内容如下:

{
    "message": "Connection could not be established with host smtp.mxhichina.com [Connection timed out #110]",
    "status_code": 500,
    "debug": {
        "line": 268,
        "file": "/xxx/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php",
        "class": "Swift_TransportException",
        "trace": [
            "#0 /xxx/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php(62): Swift_Transport_StreamBuffer->_establishSocketConnection()",
            "#1 /xxx/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php(113): Swift_Transport_StreamBuffer->initialize(Array)",
            "#2 /xxx/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php(79): Swift_Transport_AbstractSmtpTransport->start()",
            "#3 /xxx/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(394): Swift_Mailer->send(Object(Swift_Message), Array)",
            "#4 /xxx/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(179): Illuminate\\Mail\\Mailer->sendSwiftMessage(Object(Swift_Message))",
            "#5 /xxx/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(284): Illuminate\\Mail\\Mailer->send('emails.change_p...', Array, Object(Closure))",
            "#6 /xxx/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(129): Illuminate\\Mail\\Mailer->handleQueuedMessage(Object(Illuminate\\Queue\\Jobs\\SyncJob), Array)",
            "#7 /xxx/vendor/laravel/framework/src/Illuminate/Queue/Jobs/SyncJob.php(46): Illuminate\\Queue\\Jobs\\Job->resolveAndFire(Array)",
            "#8 /xxx/vendor/laravel/framework/src/Illuminate/Queue/SyncQueue.php(27): Illuminate\\Queue\\Jobs\\SyncJob->fire()",
            "#9 /xxx/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php(195): Illuminate\\Queue\\SyncQueue->push('mailer@handleQu...', Array, NULL)",
            "#10 /xxx/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(219): Illuminate\\Mail\\Mailer->queue('emails.change_p...', Array, 'C:32:\"SuperClos...')",
            "#11 /xxx/app/Api/Controllers/BaseController.php(223): Illuminate\\Support\\Facades\\Facade::__callStatic('queue', Array)",
            "#12 /xxx/app/Api/Controllers/V1/CustomerController.php(967): App\\Api\\Controllers\\BaseController->fun_send_email(Array)",
            "#13 [internal function]: App\\Api\\Controllers\\V1\\CustomerController->forgotPassword(Object(Dingo\\Api\\Http\\Request))",
            "#14 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(256): call_user_func_array(Array, Array)",
            "#15 /xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(164): Illuminate\\Routing\\Controller->callAction('forgotPassword', Array)",
            "#16 /xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\\Routing\\ControllerDispatcher->call(Object(App\\Api\\Controllers\\V1\\CustomerController), Object(Illuminate\\Routing\\Route), 'forgotPassword')",
            "#17 [internal function]: Illuminate\\Routing\\ControllerDispatcher->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#18 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Dingo\\Api\\Http\\Request))",
            "#19 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#20 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Dingo\\Api\\Http\\Request))",
            "#21 /xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
            "#22 /xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(68): Illuminate\\Routing\\ControllerDispatcher->callWithinStack(Object(App\\Api\\Controllers\\V1\\CustomerController), Object(Illuminate\\Routing\\Route), Object(Dingo\\Api\\Http\\Request), 'forgotPassword')",
            "#23 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(Dingo\\Api\\Http\\Request), 'App\\\\Api\\\\Control...', 'forgotPassword')",
            "#24 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\\Routing\\Route->runWithCustomDispatcher(Object(Dingo\\Api\\Http\\Request))",
            "#25 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\\Routing\\Route->run(Object(Dingo\\Api\\Http\\Request))",
            "#26 [internal function]: Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#27 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Dingo\\Api\\Http\\Request))",
            "#28 /xxx/vendor/dingo/api/src/Http/Middleware/PrepareController.php(45): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#29 [internal function]: Dingo\\Api\\Http\\Middleware\\PrepareController->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#30 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#31 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#32 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Dingo\\Api\\Http\\Request))",
            "#33 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(710): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
            "#34 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(674): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Dingo\\Api\\Http\\Request))",
            "#35 /xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\\Routing\\Router->dispatchToRoute(Object(Dingo\\Api\\Http\\Request))",
            "#36 /xxx/vendor/dingo/api/src/Routing/Adapter/Laravel.php(81): Illuminate\\Routing\\Router->dispatch(Object(Dingo\\Api\\Http\\Request))",
            "#37 /xxx/vendor/dingo/api/src/Routing/Router.php(513): Dingo\\Api\\Routing\\Adapter\\Laravel->dispatch(Object(Dingo\\Api\\Http\\Request), 'v1')",
            "#38 /xxx/vendor/dingo/api/src/Http/Middleware/Request.php(126): Dingo\\Api\\Routing\\Router->dispatch(Object(Dingo\\Api\\Http\\Request))",
            "#39 [internal function]: Dingo\\Api\\Http\\Middleware\\Request->Dingo\\Api\\Http\\Middleware\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#40 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Dingo\\Api\\Http\\Request))",
            "#41 /xxx/app/Http/Middleware/VerifyCsrfToken.php(24): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#42 [internal function]: App\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#43 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#44 /xxx/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#45 [internal function]: Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#46 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#47 /xxx/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#48 [internal function]: Illuminate\\Session\\Middleware\\StartSession->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#49 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#50 /xxx/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#51 [internal function]: Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#52 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#53 /xxx/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#54 [internal function]: Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#55 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#56 /xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#57 [internal function]: Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#58 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#59 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Dingo\\Api\\Http\\Request))",
            "#60 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Dingo\\Api\\Http\\Request))",
            "#61 /xxx/vendor/dingo/api/src/Http/Middleware/Request.php(127): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
            "#62 /xxx/vendor/dingo/api/src/Http/Middleware/Request.php(103): Dingo\\Api\\Http\\Middleware\\Request->sendRequestThroughRouter(Object(Dingo\\Api\\Http\\Request))",
            "#63 [internal function]: Dingo\\Api\\Http\\Middleware\\Request->handle(Object(Dingo\\Api\\Http\\Request), Object(Closure))",
            "#64 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)",
            "#65 [internal function]: Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))",
            "#66 /xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\\Http\\Request))",
            "#67 /xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))",
            "#68 /xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))",
            "#69 /xxx/index.php(53): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))",
            "#70 {main}"
        ]
    }
}

不知道是什么原因,如有人碰到过,请告知,谢谢!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左耳近心 2022-09-13 04:26:24

不知道什么原因?日志写的很明确啊,连不上smtp.mxhichina.com ,自己用服务器ping一下,从网络层找原因把

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文