Test Laravel SMTP Mail via Tinker

Testing Laravel SMTP Mail via PHP Artisan Tinker

Test Laravel SMTP Mail via Tinker

After configuring SMTP sometime we need to test if it works or not without sending a real email. There’s a solution for that.

  1. First, go to the Laravel app directory and then open tinker by running this command: php artisan tinker.
  2. After that, you can enter this command:
Mail::raw('Testing Email', function ($message){ $message->to('[email protected]')->subject('Test Email'); });

Don’t forget to replace [email protected] with your active email. If the configuration is correct then an email will be sent to your inbox: