Quickly test email sending with… artisan tinker!

Artisan tinker is a wonderful command-line helper to run any simple code. I was often using it to test simple things like if there is any data in Eloquent model or something like that. But today I realised it’s much more powerful. So when faced the task of testing if Mailgun is working for one of the clients – here’s how it looked.

  • SSH into the server
  • Run php artisan tinker
  • Run Laravel code – Mail::send() with any simple view

This is how it looked in “real life”.

artisan tinker

So the attempt failed – apparently I had unactivated account. After doing the activation, I ran the command again, and there we go.

artisan tinker email

And received an email to the inbox with a beautiful “Be right back” 503 template.

artisan tinker email

That’s it, a quick tip – hopefully helpful!

Like our articles?
Check out our Laravel online courses!



Please enter your comment!
Please enter your name here