Laravel - How to send email from tinker/cli

Quick and easy method to test email functionality in Laravel using Tinker CLI. Learn how to verify your SMTP configuration by sending test emails directly from the command line.

T Theodoros Kafantaris July 10, 2024 1 min read
Laravel - How to send email from tinker/cli

When I setup my SMTP config in .env file, I want to check immediately if it works.

First of all, I connect to tinker cli.

Code
                    php artisan tinker
                


The easiest way that I found is to execute from tinker the following command.

Code
                    Mail::raw('Hello World!', function($msg) {$msg->to('thkafadaris@atomic.gr')->subject('Test Email'); });
                


That's it. If everything is fine the Test Email will arrive to my inbox!

Tags

Share this post

Back to Blog

Let's talk

Stay Curious. Stay Inspired.

Join our community of thinkers, developers, and lifelong learners. Explore ideas that challenge and inspire you to think differently.