I just set up a beanstalkd / supervisor config on my server. The queues are working, but when I try and use Laravel's Mail function in conjunction, the emails are not sending.
I do use gmail for sending out mails, which has not been an issue when using Mail::send in my other normal code. It seems to only not send when I try via a queue.
Route:
Route::get('/', function() {
$test = "my name";
Queue::push('DuplicateAccount', $test);
});
Class:
class DuplicateAccount {
public static function fire($job, $data) {
self::send($data);
$job->delete();
}
public static function send($data) {
$admin = 'MyEmail';
Mail::send('emails.admin.duplicate', array('duplicate'=>$data), function($message) use ($admin) {
$message->to($admin, 'MyName')->subject('Subscription Duplicate');
});
Log::info('a. Mail '.$data.' to '.$admin.'.');
}
}
There was an issue with my mail driver settings apparently. Most likely an issue with gmail and my php.ini configuration when handling the serialization of the queue'd emails.
I changed to smtp and it started to work.
I think you need to start Queue Listener
php artisan queue:listen
please visit the link( http://laravel.com/docs/queues#running-the-queue-listener )
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.