Using Mail::queue with iron.io

五迷三道 提交于 2019-12-13 20:06:53

问题


I'm trying to use the Mail::queue in Laravel 4 without success.

When I run the command:

php artisan queue: subscribe queue_name http://foo.com/queue/push

It is created on my dashboard a subscriber, and also when I access my route queue/send a new queue is sent to Iron.io.

The problem is that I never received the email should be sent when the Mail::queue to be executed.

Look my routes:

<?php
Route::post('queue/push', function() {
        return Queue::marshal();
    });

Route::get('queue/send', function() {
        Mail::queue('emails.teste', array(), function($message) {
                    $message->to('me@mesite.com', 'Renato')->subject('Welcome!');
                });

        return 'Ok';
    });

Is there any configuration beyond queues.php I need to do?

When I change the queue/push (for debug) to accept GET and access the URL, the following error appears:

lluminate\Encryption\DecryptException

Invalid data.


回答1:


I might be off, but Mail::send() is the correct function to use, since you are using Iron.io to handle the queue.

This should work:

Route::get('queue/send', function() {

    Queue::push(function($job) {

        Mail::send('emails.teste', array(), function($message) {
            $message->to('me@mesite.com', 'Renato')->subject('Welcome!');
        });

        $job->delete();
    }

    return 'Ok';
});

I'd also suggest checking your Iron.io account to ensure that the 'subscriber' URL is set-up correctly. As Rob W suggests, the space could be causing issues.



来源:https://stackoverflow.com/questions/17371017/using-mailqueue-with-iron-io

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!