vainway 's avatar

use gmail for verification in laravel

i have an error on my website am trying to use gmail for password reset and verification email

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=123456
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS= [email protected]
MAIL_FROM_NAME= webname

i used all the requests but am getting error like this

Failed to authenticate on SMTP server with username "[email protected]" 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 o66sm7898816qka.60 - 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 o66sm7898816qka.60 - 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 o66sm7898816qka.60 - gsmtp ".

how can fix it

0 likes
9 replies
Snapey's avatar

also make sure you always quote passwords in your .env file

1 like
vainway 's avatar

@snapey by set google email account its done but the problem i have now is how can i edit the page that is sent to gmail may be reset password page or verification page then i put on my own designs

i want also to edit password reset link am given cause my users can't know that they should change from the url

http://localhost:/password/reset/ce1486d6f899b766d8d04622a42671cd41cba7dc6b9174cb47b4a55eb5a48626?email=vainqueurniyo%40gmail.com 

to this

http://localhost:8000/password/reset/ce1486d6f899b766d8d04622a42671cd41cba7dc6b9174cb47b4a55eb5a48626?email=vainqueurniyo%40gmail.com

another question what is the difference betwen

@csrf

and

 <input type="hidden" name="token" value="{{ $token }}">

reset password page

<form method="POST" action="{{ route('password.update') }}">
                @csrf

                <input type="hidden" name="token" value="{{ $token }}">

                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="bmd-label-floating">{{ __('E-Mail Address') }}</label>
                      <input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email">
                      @error('email')
                          <span class="invalid-feedback" role="alert">
                              <strong>{{ $message }}</strong>
                          </span>
                      @enderror
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="bmd-label-floating">{{ __('Password') }}</label>
                      <input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
                      @error('password')
                          <span class="invalid-feedback" role="alert">
                              <strong>{{ $message }}</strong>
                          </span>
                      @enderror
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-md-12">
                    <div class="form-group">
                      <label class="bmd-label-floating">{{ __('Confirm Password') }}</label>
                      <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
                      @error('email')
                          <span class="invalid-feedback" role="alert">
                              <strong>{{ $message }}</strong>
                          </span>
                      @enderror
                    </div>
                  </div>
                </div>
                <button type="submit" class="btn btn-info pull-right">{{ __('Reset Password') }}</button>
                <div class="clearfix"></div>
              </form>
Snapey's avatar

We're on to a different question now?

It uses the notifications template which you can publish with php artisan vendor:publish

Snapey's avatar

what is the difference between

@csrf

and

<input type="hidden" name="token" value="{{ $token }}">

No practical difference. @csrf was added as a blade shortcut in later versions, so depending on the age of any tutorial you are looking at you may see the earlier format.

vainway 's avatar

am told to paste the url below so which will i move and paste my url

@isset($actionText)
@slot('subcopy')
@lang(
    "If you’re having trouble clicking the \":actionText\" button, copy and paste the URL below\n". is it here
    'into your web browser: [:actionURL](:actionURL)',
    [
        'actionText' => $actionText,
        'actionURL' => $actionUrl,
    ]
)
@endslot
@endisset
@endcomponent

may be in these variables below

Snapey's avatar

Sorry. I have not any idea if there was a question there.

The URL in the email for password reset is set in APP_URL you do not need to edit the template for this.

vainway 's avatar

i changed APP_URL and it worked but why does it remove the style of my web it shows html style only with no designs i tried also look if its the problem of my folders but its not the problem why does it change

by the way when i view it without the email link am given i looks well as always but if i click the reset link am given it comes with no styles

Snapey's avatar

Is this question #4 now?

Probably because in your layout files you are not making the CSS file path absolute. Instead it is relative to the current URL

You need to see this by opening the network Dev tools in the browser and refreshing the page, you will probably see it failing to load the CSS file because it is trying to get it from the wrong place.

Please or to participate in this conversation.