How to send test email from the command line with larave

How to send test email from the command line with larave

If you've just finished setting up your mail settings for your Laravel app you probably want to give them a test. You could dive into your app and perform an action that results in an email being sent, but there's a quick and easy way to test them via Laravel Tinker on the command line.

SSH into your server or open a prompt in the root of your Laravel project and start a tinker session.

php artisan tinker

Then, use the Mail facade to send a quick test email. Make sure to change your email. You can also chain any of the other methods on a normal email here. For example, you could use $msg->from('[email protected]'); to customise the sender email address.

Mail::raw('Hello World!', function($msg) {$msg->to('[email protected]')->subject('Test Email'); });

That's all.

- Last updated 2 weeks ago

Be the first to leave a comment.

You must login to leave a comment