Laravel / Vue单页应用程序有麻烦。 我必须通过REST Api(POST方法)从客户端表单向Laravel路由请求JSON,并且该数据将发送到电子邮件。 在artisan下的本地服务器中,请求和项目的所有其他功能均正常运行,但是当我将其部署在主机上时,出现内部错误500,并且请求不起作用。 很抱歉使用大代码,但是我不知道如何解决这个严重问题,这是某种Laravel-armageddon:
{
"message": "Failed to authenticate on SMTP server with username \"narzantaria@gmail.com\" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code \"534\", with message \"534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbup\r\n534-5.7.14 63RQjJaYK-rTFJ_qwOhBI0d-QH6TZ8_z_QtKX9fN0xXgm_pmKEf8oYa4ua18ByUtRBx1nB\r\n534-5.7.14 -GMpG-hb47bWHMSTq-i2SVX5P3YXhRD91F9zoNt1Rgzk7BrOX3bcZCz9DBP3ko> Please\r\n534-5.7.14 log in via your web browser and then try again.\r\n534-5.7.14 Learn more at\r\n534 5.7.14 [url]https://support.google.com/mail/answer/78754[/url] a18sm444902ljf.35 - gsmtp\r\n\". Authenticator PLAIN returned Expected response code 235 but got code \"534\", with message \"534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=AKgnsbuI\r\n534-5.7.14 2A0XhMB-7K-5U3YxSA7QbcIwuvKjNc3dmwAMEUoAX1vpqtEuFTSrk6PLXVhZ0PIwW_QNQ2\r\n534-5.7.14 hkIF_7AIZzvoRKLUWdGW3UlqdkfPk0dSafE6LVM_glhq-DCTv_UJHxYjS17Kcb> Please\r\n534-5.7.14 log in via your web browser and then try again.\r\n534-5.7.14 Learn more at\r\n534 5.7.14 [url]https://support.google.com/mail/answer/78754[/url] a18sm444902ljf.35 - gsmtp\r\n\". Authenticator XOAUTH2 returned Expected response code 250 but got code \"535\", with message \"535-5.7.8 Username and Password not accepted. Learn more at\r\n535 5.7.8 [url]https://support.google.com/mail/?p=BadCredentials[/url] a18sm444902ljf.35 - gsmtp\r\n\".",
"exception": "Swift_TransportException",
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/Esmtp/AuthHandler.php",
"line": 191,
"trace": [
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/EsmtpTransport.php",
"line": 371,
"function": "afterEhlo",
"class": "Swift_Transport_Esmtp_AuthHandler",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/AbstractSmtpTransport.php",
"line": 148,
"function": "doHeloCommand",
"class": "Swift_Transport_EsmtpTransport",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Mailer.php",
"line": 65,
"function": "start",
"class": "Swift_Transport_AbstractSmtpTransport",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php",
"line": 484,
"function": "send",
"class": "Swift_Mailer",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php",
"line": 259,
"function": "sendSwiftMessage",
"class": "Illuminate\\Mail\\Mailer",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php",
"line": 159,
"function": "send",
"class": "Illuminate\\Mail\\Mailer",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Support/Traits/Localizable.php",
"line": 19,
"function": "Illuminate\\Mail\\{closure}",
"class": "Illuminate\\Mail\\Mailable",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/Mailable.php",
"line": 160,
"function": "withLocale",
"class": "Illuminate\\Mail\\Mailable",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php",
"line": 275,
"function": "send",
"class": "Illuminate\\Mail\\Mailable",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php",
"line": 229,
"function": "sendMailable",
"class": "Illuminate\\Mail\\Mailer",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Mail/PendingMail.php",
"line": 127,
"function": "send",
"class": "Illuminate\\Mail\\Mailer",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/app/Http/Controllers/OrderController.php",
"line": 23,
"function": "send",
"class": "Illuminate\\Mail\\PendingMail",
"type": "->"
},
{
"function": "order",
"class": "App\\Http\\Controllers\\OrderController",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Controller.php",
"line": 54,
"function": "call_user_func_array"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php",
"line": 45,
"function": "callAction",
"class": "Illuminate\\Routing\\Controller",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 219,
"function": "dispatch",
"class": "Illuminate\\Routing\\ControllerDispatcher",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Route.php",
"line": 176,
"function": "runController",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 680,
"function": "run",
"class": "Illuminate\\Routing\\Route",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php",
"line": 41,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Routing\\Middleware\\SubstituteBindings",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php",
"line": 75,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php",
"line": 49,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\View\\Middleware\\ShareErrorsFromSession",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php",
"line": 56,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Session\\Middleware\\StartSession",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php",
"line": 37,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php",
"line": 66,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Cookie\\Middleware\\EncryptCookies",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 104,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 682,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 657,
"function": "runRouteWithinStack",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 623,
"function": "runRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Router.php",
"line": 612,
"function": "dispatchToRoute",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 176,
"function": "dispatch",
"class": "Illuminate\\Routing\\Router",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 30,
"function": "Illuminate\\Foundation\\Http\\{closure}",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/fideloper/proxy/src/TrustProxies.php",
"line": 57,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Fideloper\\Proxy\\TrustProxies",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php",
"line": 21,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php",
"line": 27,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php",
"line": 62,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 163,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php",
"line": 53,
"function": "Illuminate\\Pipeline\\{closure}",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php",
"line": 104,
"function": "Illuminate\\Routing\\{closure}",
"class": "Illuminate\\Routing\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 151,
"function": "then",
"class": "Illuminate\\Pipeline\\Pipeline",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php",
"line": 116,
"function": "sendRequestThroughRouter",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
},
{
"file": "/home/s/shutruk/angel-abkhazia.ru/public/index.php",
"line": 55,
"function": "handle",
"class": "Illuminate\\Foundation\\Http\\Kernel",
"type": "->"
}
]
}
这是.env文件设置(邮件):
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=narzantaria@gmail.com
MAIL_PASSWORD=my_password
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=narzantaria@gmail.com
MAIL_FROM_NAME=Shutruk
mail.php设置:
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.gmail.com'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'narzantaria@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
'log_channel' => env('MAIL_LOG_CHANNEL'),
];
这真的很有趣,关键是什么,如果它在本地服务器上可以工作,但是当我将其复制到主机而不进行任何更改时,它就变成了越野车。 我再也不能相信这可以解决,非常感谢大家的帮助。 对不起我的法语。
答案 0 :(得分:0)
您是否可以尝试检查,如果您在gmail帐户中收到一封邮件,指出正在某个远程位置使用了您的帐户。 Gmail限制对安全性较低的应用程序的访问。您可以在smtp中启用较少访问权限的应用。