简体   繁体   English

使用Mail :: queue和iron.io

[英]Using Mail::queue with iron.io

I'm trying to use the Mail::queue in Laravel 4 without success. 我试图在Laravel 4中使用Mail ::队列但没有成功。

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. 它是在我的仪表板上创建的一个订阅者,当我访问我的路由队列/发送新队列时也会发送到Iron.io.

The problem is that I never received the email should be sent when the Mail::queue to be executed. 问题是我从未收到过应该在Mail ::队列执行时发送的电子邮件

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? 是否有任何超出queues.php的配置我需要做什么?

When I change the queue/push (for debug) to accept GET and access the URL, the following error appears: 当我更改队列/推送(用于调试)以接受GET并访问URL时,会出现以下错误:

lluminate\\Encryption\\DecryptException lluminate \\加密\\ DecryptException

Invalid data. 无效数据。

I might be off, but Mail::send() is the correct function to use, since you are using Iron.io to handle the queue. 我可能会关闭,但Mail::send()是正确使用的函数,因为您使用Iron.io来处理队列。

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. 我还建议您检查您的Iron.io帐户,以确保“订阅者”网址设置正确。 As Rob W suggests, the space could be causing issues. 正如Rob W所暗示的那样,这个空间可能会引发问题。

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

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