0
I’m trying to make a cron in the Standard to send an email every 1 minute, but no e-mail has been sent so far.
Man Emailadocaocron.php:
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\animalAdocao;
use Mail;
class EmailAdocaoCron extends Command
{
protected $signature = 'example:cron';
protected $description = 'Command E-mail';
public function __construct()
{
parent::__construct();
}
public function handle()
{
$animaisAdocao = animalAdocao::all();
for($i = 0; $i < count($animaisAdocao); $i++){
$data = array(
'apelido' => $animaisAdocao[$i]['apelido']
);
Mail::send('emailadocaoconfirmacao', $data, function ($message) use ($animaisAdocao, $i){
$message->from('[email protected]', 'Ei, email teste')->subject('Confirmação do seu anúncio');
$message->to($animaisAdocao[$i]['email_contato']);
});
}
}
}
My kernel.php:
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
protected $commands = [
Commands\EmailAdocaoCron::class
];
protected function schedule(Schedule $schedule)
{
$schedule->command('example:cron')->everyMinute();
}
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
Something is missing?
This is my table where I pick up the emails to send:
configured SMTP shipping service?
– Renato Tavares
Yes, I got it, you have to create a file . bat and use with xampp
– veroneseComS