简体   繁体   English

Laravel邮件不通过队列发送

[英]Laravel Mail Not Sending Via Queue

I just set up a beanstalkd / supervisor config on my server. 我只是在我的服务器上设置了beanstalkd / supervisor配置。 The queues are working, but when I try and use Laravel's Mail function in conjunction, the emails are not sending. 队列正在运行,但当我尝试结合使用Laravel的邮件功能时,电子邮件不会发送。

I do use gmail for sending out mails, which has not been an issue when using Mail::send in my other normal code. 我使用gmail发送邮件,这在我的其他普通代码中使用Mail :: send时不是问题。 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. 在处理队列电子邮件的序列化时,很可能是gmail和我的php.ini配置的问题。

I changed to smtp and it started to work. 我改为smtp,它开始工作了。

I think you need to start Queue Listener 我想你需要启动Queue Listener

php artisan queue:listen

please visit the link( http://laravel.com/docs/queues#running-the-queue-listener ) 请访问链接( http://laravel.com/docs/queues#running-the-queue-listener

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM