简体   繁体   中英

Using Mail::queue with iron.io

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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