I implemented auth system by php artisan make:auth
and already setup user email verify by MustVerify from laravel feature
I want to send another email (Greeting mail) after user click verify link. How can I do that?
When a user is registered a Illuminate/Auth/Events/Verified
event is broadcast.
You can use this artisan command to generate a listener
php artisan make:listener SendWelcomeMail
In the listener you can add logic to the handle($event)
function.
public function handle(Verified $event)
{
Mail::to($event->user->email)->send(new Greeting());
}
Then you register the listener with the event in the EventServiceProvider
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
Verified::class => [
SendWelcomeMail::class
],
];