Laravel - How to send email from tinker/cli

Laravel - How to send email from tinker/cli

T

Theodoros Kafantaris

Published on July 10, 2024

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!

About Our Blog

Discover insights, tutorials, and best practices in software development. Our team shares practical knowledge and cutting-edge techniques to help developers build better applications.

Ⓒ 2025. All rights reserved by atomic