I have a problem sending a lot of emails from my Laravel app.
Before explain the issues, this is the server config:
Server: Google Compute Engine, VM Instance (Ubuntu Server) - Standar 1
This is my configuration:
MAIL_DRIVER=smtp
MAIL_HOST=smtp-relay.gmail.com
MAIL_PORT=587
MAIL_USERNAME=my_email@mydomain.com
MAIL_PASSWORD=********
MAIL_ENCRYPTION=tls
So, I use Google App work Account for this purpose and all works very well when i send emails for one recipient!
The problem is when i try to send email to all my customers:
foreach ($users as $key => $user) {
// content construction
if ($have_one){
Mail::queue('emails.contact', $body, function($message) use($email)
{
$message->from('info@mydomain.com', 'My Name Team');
$message->to($email)->subject('Fake Subject!');
});
}
}
It work well the very firsts 100-200 emails sent, but in some point it just crash it!!!
I use a php artisan command to send this emails, and this is the output:
output sending email
Does anyone know how to fix it?
Thanks in advance!