Laravel по-русски

Русское сообщество разработки на PHP-фреймворке Laravel.

Ты не вошёл. Вход тут.

#1 06.06.2019 21:34:26

Ошибка 500 при отправке формы

Всем привет! Помогите, это ужас какой-то!
Проект Laravel/Vue.JS Single Page Application (RESTful API).

При отправке формы передается JSON методом POST, а его данные затем отправляются на email.
На локальном сервере под арестантом все работает, письма отправляются, все красиво, но после переноса на хост выдает ошибку 500.

{
    "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=тут_пароль
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'),

];

В чем может быть причина, если на локальном сервере все работает, а при переносе без изменений на хост (провайдер бегет), начинается какая-то чертовщина?
Заранее всем огромное спасибо!

Не в сети

#2 18.06.2019 10:54:34

Re: Ошибка 500 при отправке формы

MAIL_DRIVER=mail попробуйте
у меня было на хостинге такое, а на локале всё работало. поменял на хостинге так

Изменено peremudrilius (18.06.2019 10:55:08)

Не в сети

Подвал раздела