I am trying to send User email verification. I have updated the env and mail configuration to suit my Google Mail. However, I am encountering a Swift_TransportException (530) error.
.env
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=okaydots@gmail.com
MAIL_PASSWORD=
mail.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', 'okaydots@gmail.com'),
'name' => env('MAIL_FROM_NAME', 'Kyle Jeynes'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('okaydots@gmail'),
'password' => env(''),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
'log_channel' => env('MAIL_LOG_CHANNEL'),
];
User.php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable;
protected $fillable = [
'name', 'email', 'password',
];
protected $hidden = [
'password', 'remember_token',
];
}
web.php
Route::get('/', function () {
return view('welcome');
});
Auth::routes(['verify' => true]);
Route::get('/home', 'HomeController@index')->name('home');
HomeController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
public function __construct()
{
$this->middleware('auth');
$this->middleware('verified');
}
public function index()
{
return view('home');
}
}
This is the exact error message I am receiving:
Expected response code 250 but got code "530", with message "530-5.5.1 Authentication Required. Learn more at 530 5.5.1 https://support.google.com/mail/?p=WantAuthError 133sm47765wme.9 - gsmtp "
After googling this error, I was told to Turn on less secure apps. After doing so, I still receive the same error. How can I allow Laravel to send email verification / emails?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire