dimanche 23 octobre 2016

Laravel send e-mail from artisan command

I want to send e-mail for new users in my application after they register (e-mail verification). I'm using the artisan command because it's rather a heavy task so I think that artisan command is the best choice.

This is my code

Artisan::call('emailActivation:send', [
     'user' => $user,
]);

return view('email-verification',[
     'success'=> $user['email'],
]);

The question is:

Sometimes, it throws an error 'Maximum execution time 30 seconds exceeded'. How can I check for this error and display an error that says the e-mail isn't sent and display a resend button ?

NB: For me, this is a fatal error, because before I send the e-mail, I have already saved the user data to the database and also the verify token



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire