Laravel по-русски

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

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

#1 Laravel 5.x » Ошибка 500 при отправке формы » 06.06.2019 21:34:26

Kiten
Ответов: 1

Всем привет! Помогите, это ужас какой-то!
Проект 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'),

];

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

#3 Laravel 5.x » Не отправляется mail » 05.06.2019 19:58:32

Kiten
Ответов: 3

Здравствуйте!
Никак не удается настроить отправку писем. При обращении к роуту выдает ошибку
"Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required\r\n"

Вот листинг.
Код app/Mail/DemoEmail.php

<?php

namespace App\Mail;
 
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
 
class DemoEmail extends Mailable
{
    use Queueable, SerializesModels;
     
    /**
     * The demo object instance.
     *
     * @var Demo
     */
    public $demo;
 
    /**
     * Create a new message instance.
     *
     * @return void
     */
    public function __construct($demo)
    {
        $this->demo = $demo;
    }
 
    /**
     * Build the message.
     *
     * @return $this
     */
    public function build()
    {
        return $this->from('sender@example.com')
                    ->view('mails.demo')
                    ->text('mails.demo_plain')
                    ->with(
                      [
                            'testVarOne' => '1',
                            'testVarTwo' => '2',
                      ])
                      ->attach(public_path('/images').'/demo.jpg', [
                              'as' => 'demo.jpg',
                              'mime' => 'image/jpeg',
                      ]);
    }
}

Контроллер app/Http/Controllers/MailController.php

<?php
namespace App\Http\Controllers;
 
use App\Http\Controllers\Controller;
use App\Mail\DemoEmail;
use Illuminate\Support\Facades\Mail;
 
class MailController extends Controller
{
    public function send()
    {
        $objDemo = new \stdClass();
        $objDemo->demo_one = 'Demo One Value';
        $objDemo->demo_two = 'Demo Two Value';
        $objDemo->sender = 'SenderUserName';
        $objDemo->receiver = 'ReceiverUserName';
 
        Mail::to("narzantaria@yandex.ru")->send(new DemoEmail($objDemo));
    }
}

Шаблон resources/views/mails/demo.blade.php

Hello <i>{{ $demo->receiver }}</i>,
<p>This is a demo email for testing purposes! Also, it's the HTML version.</p>
 
<p><u>Demo object values:</u></p>
 
<div>
<p><b>Demo One:</b>&nbsp;{{ $demo->demo_one }}</p>
<p><b>Demo Two:</b>&nbsp;{{ $demo->demo_two }}</p>
</div>
 
<p><u>Values passed by With method:</u></p>
 
<div>
<p><b>testVarOne:</b>&nbsp;{{ $testVarOne }}</p>
<p><b>testVarTwo:</b>&nbsp;{{ $testVarTwo }}</p>
</div>
 
Thank You,
<br/>
<i>{{ $demo->sender }}</i>

Шаблон resources/views/mails/demo_plain.blade.php

Hello {{ $demo->receiver }},
This is a demo email for testing purposes! Also, it's the HTML version.
 
Demo object values:
 
Demo One: {{ $demo->demo_one }}
Demo Two: {{ $demo->demo_two }}
 
Values passed by With method:
 
testVarOne: {{ $testVarOne }}
testVarOne: {{ $testVarOne }}
 
Thank You,
{{ $demo->sender }}

config/mail.php

<?php

return [

    'driver' => env('MAIL_DRIVER', 'smtp'),

    'host' => env('MAIL_HOST', 'smtp.mailgun.org'),

    'port' => env('MAIL_PORT', 587),

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'hello@example.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'),

];

Раздел MAIL в .env без изменений

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Роут:

Route::get('mail/send', 'MailController@send');

Буду очень благодарен за любую помощь. Честно говоря, мне уже не верится, что удастся выполнить эту задачу.
Спасибо за внимание:)

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