protonemedia / laravel-verify-new-email

This package adds support for verifying new email addresses: when a user updates its email address, it won't replace the old one until the new one is verified.
https://protone.media/en/blog/an-add-on-to-laravels-built-in-email-verification-only-update-a-users-email-address-if-the-new-one-is-verified-as-well
MIT License
401 stars 31 forks source link

Email is not sent #16

Open alex1897 opened 2 years ago

alex1897 commented 2 years ago

I implemented the package on my local machine with sail. Everything seemed fine and I was able to receive the mails after changing the email address.

Once I uploaded it on my server, nothing happened after the email is changed. In the pending_user_emails table the entry with the new email is adde, but the mail is missing. No error message and nothing in the log.

First I thought mailing is not working at all, but the laravel Breeze emails are being sent out.

On my server I have PHP 8.1.5 and Laravel is on Version 9.2.

And idea what I should/can check to find the issue?

HayderThamer92 commented 2 years ago

True. Vote +1

jimsawinner commented 1 year ago

Any updates on this issue? I seem to be having this issue also, this was working OK on PHP7.4 and Laravel 7. But I updated to PHP8.1 with Laravel 8 and now the package seems not to be sending the new email verifications.

jimsawinner commented 1 year ago

For anyone that is having this issue I have found the cause (and potentially the solution). @alex1897 @HayderThamer92

The mailable class is implementing ShouldQueue which means the mail is being queued in the jobs table (check your database table jobs).

Which means the email will only send once the job has been dispatched - try running php artisan queue:work

Let me know if this helps

Fradd747 commented 1 year ago

To extend @jimsawinner answer. The mail is added to the queue ("jobs" table in db) and it's waiting for a worker to dispatch it. On local dev, you can use artisan queue:work command to start a worker manually, although you'll need to set up a supervisor service on your production server. More info can be found here https://laravel.com/docs/10.x/queues#supervisor-configuration.