Laravel电子邮件队列无限处理?

时间:2017-08-18 10:43:41

标签: laravel amazon-web-services laravel-5 amazon-sqs

我正在使用Laravel 5.4和AWS SQS。我已经测试了它正在做各种各样的工作并且工作正常,但是当我尝试排队电子邮件时我得到了:

[2017-08-18 09:21:48] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:48] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:48] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:48] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:49] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:50] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:50] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:50] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:50] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:50] Processing: App\Mail\WelcomeEmail
[2017-08-18 09:21:50] Processing: App\Mail\WelcomeEmail

然而,正如你猜测的那样,如果我在没有队列的情况下发送它,它就可以正常工作。

这是执行它的代码,

protected function create(array $data)
{
    Mail::to($data['email'])
        ->queue(new WelcomeEmail());
    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
    ]);
}

WelcomeEmail:

{
    return $this->from('support@dev.com')
                ->view('emails.welcomeEmail')
                ->attach('pdf/tc.pdf',[
                    'as' => 'tc.pdf',
                    'mime' => 'application/pdf',
                    ]);
}

welcomeEmail blade

<body>
    <h4>hello</h4>
    <img src="{{ $message->embed(public_path('images/logo.png')) }}" ) }}"> 

<b>We search high and low across city to bring you as much information content as possible, personalised to your interests!</b>

<p>We'll bring you all the latest live restaurant deals, sports events, travel info, show times, and much much more. If there's something you need to know or something exciting going on, you'll be the first to know about it.</p>

<p>Log in to your account and start customising your alerts today!</p>

<a class="btn btn-success" href="http://localhost:8000/profile">View Your Profile!</a>

</body>

0 个答案:

没有答案