Reputation: 444
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.'.');
}
}
Upvotes: 4
Views: 7432
Reputation: 444
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.
Upvotes: 4
Reputation: 11
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)
Upvotes: 0