Laravel 安排不发送电子邮件
Laravel schedule don´t send email
我正在尝试按照 laravel 的时间表发送电子邮件,所有 API 配置都在控制器中工作,但在时间表中没有
public function handle()
{
$lateLoans = ReaderRecord::where('estado', 'atraso')->get();
$stolenLoan = ReaderRecord::where('estado', 'robo')->get();
foreach ($lateLoans as $lateLoan)
{
$loanDate = new Carbon($lateLoan['entrega']);
$today = Carbon::today();
$mailData = [
'title' => 'Informe de préstamo',
'name' => $lateLoan->reader['nombre'],
'lastName' => $lateLoan->reader['apellido_paterno'],
'book' => $lateLoan->record->book['titulo'],
'idBook' => $lateLoan->record['id'],
'days' => $loanDate->diffInDays($today),
'endDate' => $lateLoan['entrega']
];
$email = $lateLoan->reader['email'];
$name = $lateLoan->reader['nombre'];
Mail::send('mail.loan.late', $mailData, function($message) use (&$email, &$name) {
$message->to($email, $name)->subject('Atraso de entrega de préstamo');
});
}
}
我不知道为什么,但解决方案是这样的
- 下载文件https://curl.haxx.se/ca/cacert.pem
- 编辑
php.ini
并添加这个
curl.cainfo = your\absolute\path\cacert.pem
我正在尝试按照 laravel 的时间表发送电子邮件,所有 API 配置都在控制器中工作,但在时间表中没有
public function handle()
{
$lateLoans = ReaderRecord::where('estado', 'atraso')->get();
$stolenLoan = ReaderRecord::where('estado', 'robo')->get();
foreach ($lateLoans as $lateLoan)
{
$loanDate = new Carbon($lateLoan['entrega']);
$today = Carbon::today();
$mailData = [
'title' => 'Informe de préstamo',
'name' => $lateLoan->reader['nombre'],
'lastName' => $lateLoan->reader['apellido_paterno'],
'book' => $lateLoan->record->book['titulo'],
'idBook' => $lateLoan->record['id'],
'days' => $loanDate->diffInDays($today),
'endDate' => $lateLoan['entrega']
];
$email = $lateLoan->reader['email'];
$name = $lateLoan->reader['nombre'];
Mail::send('mail.loan.late', $mailData, function($message) use (&$email, &$name) {
$message->to($email, $name)->subject('Atraso de entrega de préstamo');
});
}
}
我不知道为什么,但解决方案是这样的
- 下载文件https://curl.haxx.se/ca/cacert.pem
- 编辑
php.ini
并添加这个
curl.cainfo = your\absolute\path\cacert.pem