I have a laravel app with a form that when it is submitted will send a mail. The mail configuration is working properly since the mail is received.
But since the process was quite slow i decided to use Queue.
I have set up Iron mq account and set it up on Laravel4.
So instead of Mail::send
i switch to Mail::queue
. Here is the code:
return \Mail::queue($this->view, $this->data, function($message) use($self)
{
$message->to($self->email, $self->to)->subject($self->subject);
});
And in the routes there is simply:
Route::post('booking', 'HomeController@booking');
Route::post('rezervesana', 'HomeController@booking'); // This is for the latvian version
When i submit the form, the queue is received in Iron mq dashboard and apparently fired. But no mail is received..
If instead i do something like this:
Route::post('booking', function()
{
return Queue::marshal();
});
Then magically it will work in the latvian version (rezervesana) but of course than the english version page does not even open anymore..
So I am quite confused.
The question is: How can I send properly a mail using Mail::queue
and how to deal with it in the routes?
I think that the code regarding the Mail::queue
is correct, what is wrong can be in routes.
So the real question can be: How I have to set up the routes to make queue working properly?
Which is the proper place for Queue::marshal
?
Thank you guys! Sorry if it is confused. Hope you can clarify it to me!