Emails not sent from command. Here is command code.
public function handle()
{
Mail::to('example@abc.com')->send(new EmailNotification());
}
However, when I try to send mail from route mail is sent.
Route::get('test_mail', function(){
Mail::to('example@abc.com')->send(new EmailNotification());
});
How can I send email from command line? When I run
php artisan send:emailNotification
it shows no errors
Complete Command code:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
use App\Mail\EmailNotification;
class SendEmailNotification extends Command
{
protected $signature = 'send:emailNotification';
protected $description = 'Send email notifications.';
public function __construct()
{
parent::__construct();
}
public function handle()
{
Mail::to('example@abc.com')->send(new EmailNotification());
}
}