I am using Laravel 5.4 with AWS SQS. I have tested it to jobs that are doing all sort of stuff and it works fine, however when I try to queue an email I get:
[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
And as you guess that goes however, if I send it without the queue it works absolutely fine.
Here's the code where it's executed,
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>