skip to Main Content

I want to do email verification. Actually, it succeeded, but only to the email in the .env file. Why didn’t other users receive the email verification link?

Model

class User extends Authenticatable implements MustVerifyEmail

web

Auth::routes(['verify' => true]);

controller

$this->middleware(['auth', 'verified']);

.env

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=zdmqlfstftkdvrsz
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="Travel"

Why was it only sent to mymail but not to other emails?

3

Answers


  1. You could try to make MAIL_FROM_ADDRESS equal to MAIL_USERNAME. If that does not match it can be disallowed

    Login or Signup to reply.
  2. If you want to debug this further, you can temporarily modify the sendEmailVerificationNotification() method in your User model to log some info.

    public function sendEmailVerificationNotification()
    {
        $email = $this->getEmailForVerification();
    
        // Log the email address to which the verification link would be sent
        Log::info('Sending email verification link to: ' . $email);
    
        $this->notify(new NotificationsVerifyEmail);
    }
    
    Login or Signup to reply.
  3. MAIL_FROM_ADDRESS needs to be an actual email address that exists. I realized that made-up email addresses like "[email protected]" don’t work.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search