I am using laravel and i need to send mail. I configured cron job and scheduler but i have a peculiar problem.
I can see that my tasks were entering the jobs table.but,when the queue:work
execute by cron job and scheduler the Jobs table be empty and also failed-jobs empty, too and I have not received any email.
My cron job command :
usr/local/phpcron/Isphplaravel73 / LaravelApp-path/artisan schedule:run >>/dev/null 2>&1
app/console/kernel.php :
Protected function schedule(Schedule $schedule)
{
$this->command('queue:work')->withoutOverlapping() ;
}
Thank you for your help.
You Have to Run Laravel schedule:run command each minute, following method will be use,
1. Make a cronjob into Linux
To edit or create crontab file, type the following command at the UNIX / Linux shell prompt:
$ crontab -e
then write Laravel Command in crontab
* * * * * usr/local/phpcron/Isphplaravel73 / LaravelApp-path/artisan schedule:run >>/dev/null 2>&1
2. Make a cronjob into your cPanel shared hosting In this step, we have to define cPanel cronjob for running our laravel schedule in every minute. For that, login into cPanel and goto Cron Jobs option then create a new cronjob like below. Select Once Per Minute
option from Common Settings dropdown box.
/usr/local/bin/php /home/hosting_user_name/your_artisan_file_path schedule:run >> /dev/null 2>&1
if Still not Working Check job output on each job run
Protected function schedule(Schedule $schedule)
{
$this->command('queue:work')->withoutOverlapping()->sendOutputTo($filePath) ;
}
sendOutputTo
laravel method for get output in file. https://laravel.com/docs/5.3/scheduling#task-output
It's not laravel or php issue, it's the server's fault. I have had this issue before, either buy premium email or use gmail smtp. Server's default emails does not work with cron as per my experience.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.