0
예약 된 laravel 작업에서 전자 메일을 보내려고합니다. 응용 프로그램에서 명령을 호출 할 때 전자 메일이 전송되지만 명령이 명령 줄에서 호출되면 실행되었지만 전송 된 이메일이 없습니다. 내 명령 코드는 다음과 같습니다php 장인의 일정 : 실행 이메일을 보내지 마십시오
php artisan emails:send
예약 된 laravel 작업에서 전자 메일을 보내려고합니다. 응용 프로그램에서 명령을 호출 할 때 전자 메일이 전송되지만 명령이 명령 줄에서 호출되면 실행되었지만 전송 된 이메일이 없습니다. 내 명령 코드는 다음과 같습니다php 장인의 일정 : 실행 이메일을 보내지 마십시오
php artisan emails:send
: 나는 콘솔에서 실행하고있는 명령은
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Inspire::class,
Commands\SendEmails::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
//{
// $schedule->command('inspire')->everyMinute();
//}
}
:
이namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Mail;
class SendEmails extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'emails:send';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
try {
Mail::send('emails.testmail', [ ], function ($m) {
$m->to('[email protected]', 'Francisco Larios')->subject('Your Reminder!');
});
} catch (\Exception $e) {
throw new \Exception("Error Processing Request", 1);
}
}
}
커널 파일의 코드는 다음입니다 문제는 내가 전자 메일을 보내려는 SMTP 서버였습니다. mail.php 연결 파일에서 다른 SMTP 서버로 변경했습니다. 응용 프로그램과 명령 줄 실행 모두에서 작동합니다.