javascript - How to send verification email with laravel's built in verification system with Gmail


With regular sign ups the user will receive a verification email. But gmail users they do not receive the email unless they click the resend button.

How do I make gmail users to receive the verification email without having to click the resend button when they register?


namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\User;
use Socialite;
use Auth;
use Exception;

class GoogleAuth extends Controller
    public function redirectToProvider()
        return Socialite::driver('google')->redirect();

    public function handleProviderCallback()
        try {
            $googleUser = Socialite::driver('google')->user();
            $existUser = User::where('email', $googleUser->email)->first();

            if ($existUser) {
            } else {
                $user = new User;
                $user->name = $googleUser->name;
                $user->email = $googleUser->email;
                $user->google_id = $googleUser->id;
                $user->password = md5(rand(1, 10000));
            return redirect()->to('/home');
        } catch (Exception $e) {
            return 'error';
}[![enter image description here][1]][1]




But 2 flags in DB, verified and is_email_sent. When user logs in check for verified if he is not, send email if is_email_sent false, otherwise log in user

People are also looking for solutions to the problem: php - How to properly re-order POST array coming from HTML?


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.