'Laravel send email SMTP

Can anyone help me with Laravel Mail function?

I changed config/mail.php file to

'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'mail.concept.kz'),
'port' => env('MAIL_PORT', 25),
'from' => ['address' => '[email protected]', 'name' => 'asdf'],
'encryption' => env('MAIL_ENCRYPTION', null),
'username' => env('[email protected]'),
'password' => env('mypassword'),
'sendmail' => '/usr/sbin/sendmail -bs',

This is my code in controller

Mail::raw($messageBody, function($message) {
            $message->from('[email protected]', 'Learning Laravel');
            $message->to('[email protected]');
        });

        if (Mail::failures()) {
            echo 'FAILED';
        }
        return redirect()->back();

I made the same changes to .env file, but nothing happens. Can anyone give me advice what to do? Am I doing something wrong?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source