Laravel 4 + Iron Mq:已触发队列,但未发送邮件 [英] Laravel 4 + Iron Mq: Queues fired but the mail is not sent

查看:65
本文介绍了Laravel 4 + Iron Mq:已触发队列,但未发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这种情况:

我有一个安装了Iron mq的Laravel 4应用,以加快该过程. 可以预订汽车并在网站上注册.在两种情况下,都会发送邮件. 问题是,在安装Iron mq之后,不再发送邮件.其余所有工作都已完成,将数据插入数据库中,但邮件发送否. 相反,在Iron mq仪表板中,队列被定期接收并显然被解雇了.

I have a Laravel 4 app with Iron mq installed in order to speed up the process. It is possible to book a car and to register in the site. In both cases a mail is sent. The problem is that after installing Iron mq the mail are not sent anymore. All the rest is done, inserting data in the database, but the mails sending no. In Iron mq dashboard the queues are instead regularly received and apparently fired..

这是路线:

 /*  CARS  */

Route::get('focus', function()
 {
return View::make('iframe');
 });
Route::post('focus', 'RegistrationsController@booking');


Route::get('sharan', function()
{
return View::make('iframe2');
 });


Route::get('passat', function()
{
return View::make('iframe5');
});

// Route::post('passat', 'RegistrationsController@booking');

 Route::post('passat', function()
 {
return Queue::marshal();    
 });

/*  USER REGISTRATION */

Route::get('register', 'HomeController@getRegister');
Route::post('register', 'HomeController@postRegister');

现在,预订汽车的过程更快,从8/9秒缩短到3秒.这意味着铁正在工作.虽然很奇怪,我只将Queue :: marshall()用于发布路线中的一个,并且对所有三个都适用. 用户注册也更快,没有任何队列:: marshall() 但关键是在两种情况下都不会发送电子邮件.

Right now the process of book a car is faster, from 8/9 sec to 3 sec. It means that Iron is working. Though is strange that i had make the Queue::marshall() for only one of the post route, and it works for all three.. The user registration is also faster, without any queue::marshall() But the point is that in the both cases no email is sent.

这是邮件发送代码:

 return \Mail::queue($this->view, $this->data, function($message) use($self)
{
   $message->to($self->email, $self->to)->subject($self->subject);

});

使用Mail :: send可以工作(但是非常慢),使用Mail :: queue可以更快,但是不发送电子邮件.

With Mail::send it works (but terribly slow), with Mail::queue is faster but the email is not sent.

主要问题是:

为什么不发送邮件? SMTP设置不应更改,对吧?

Why the mail are not sent? The SMTP settings should not change, right?

Queue :: marshall()的正确位置是什么? 如果要进行注册的POST,我必须调用适当的方法 路线:: post('register','HomeController @ postRegister'); 然后,我必须将Queue :: marshall()放在哪里? 可以做两条路线吗?调用该方法并使Queue :: marshall?

What is the proper place for Queue::marshall() ? If for the POST of the registration i must call the proper method Route::post('register', 'HomeController@postRegister'); Then, where i have to put the Queue::marshall() ? Is possible to make a double route? Call the method and make Queue::marshall?

非常感谢! 已经有以前的网站存在相同的问题,无法解决.

Thank you very much! Already for a previous site had the same problems and never resolve.

推荐答案

此调度调用的目的只是使您的应用程序处理队列作业.因此,为您的元帅创建一条单独的路线,仅铁将使用该路线:

The objective of this marshal call is just to make your application process your queues jobs. So, create a separate route for your marshal, it will be used only by Iron:

Route::post('queues/marshal', function()
{
    return Queue::marshal();    
});

然后,您只需要在Iron队列中预订元帅URL:

Then you just have to subscribe your marshal url in your Iron queue:

http://yoursite.com/queues/marshal

这篇关于Laravel 4 + Iron Mq:已触发队列,但未发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆