0

My error is here:

Failed to authenticate on SMTP server with username "almamun00021@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials k24sm4734732pgf.59 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials k24sm4734732pgf.59 - gsmtp ". 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 535 5.7.8 https://support.google.com/mail/?p=BadCredentials k24sm4734732pgf.59 - gsmtp ".

.env file configuration

MAIL_DRIVER=smtp

MAIL_HOST=smtp.gmail.com

MAIL_PORT=587

MAIL_USERNAME=almamun00021@gmail.com

MAIL_PASSWORD=

MAIL_ENCRYPTION=tls

mail.php

<?php


return [

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

    'host' => env('MAIL_HOST', 'smtp.gmail.com'),

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

    'from' => ['address' => 'almamun00021@gmail.com', 'name' => 'NewShop'],

    'encryption' => env('MAIL_ENCRYPTION', 'tls'),

    'username' => env('MAIL_USERNAME'),

    'password' => env('MAIL_PASSWORD'),

    'sendmail' => '/usr/sbin/sendmail -bs',

    'pretend' => false,


];



<?php

controller:

namespace App\Http\Controllers;

use App\customer;

use Illuminate\Http\Request;

use Mail;

use Session;

class CheckoutUserController extends Controller
{
    public function index()
    {
        return view('userAuth.login');
    }

    public function UserSignup(Request $request)
    {
       $customer = new customer();
       $customer->username = $request-> username;
       $customer->email    = $request-> email;
       $customer->phone    = $request-> phone;
       $customer->password = bcrypt($request->  password);
       $customer->save();

       $customerId = $customer->id;`
    enter code here
       Session::put('customerId',$customerId);
       Session::put('Username',$customer->username);

       $data = $customer->toArray();
       Mail::send('mail.confirmation-mail',$data, function ($message) use ($data){
           $message->to($data['email']);
           $message->subject('Confirmation mail');
       });
       return "success";
    }
}
Premlatha
  • 1,676
  • 2
  • 20
  • 40
Al Mamun
  • 11
  • 4
  • Google already told you what to do. Follow that link and do exactly what Google told you to do in https://support.google.com/mail/?p=BadCredentials. And I'm sure you included your password in `.env` right? – glinda93 Feb 25 '20 at 07:14
  • Welcome to SO. Please try searching for similar questions before posting a new one, eg searching just for your error msg shows this is a very well known problem, [with a well known solution](https://stackoverflow.com/questions/42558903/expected-response-code-250-but-got-code-535-with-message-535-5-7-8-username). – Don't Panic Feb 25 '20 at 09:10
  • yeah thank you :) Don't panic – Al Mamun Feb 25 '20 at 19:11

0 Answers0