Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 30079

Emails not sent from laravel commands

$
0
0

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());
    }
}


Viewing all articles
Browse latest Browse all 30079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>