I am using Mailtrap for testing. I have this array that contains the email address (recipient) and unique data.
array:3 [
0 => array:3 [
"email" => "test1@email.com"
"report" => "Report 1"
"count" => "20"
]
1 => array:3 [
"email" => "test2@email.com"
"report" => "Report 3"
"count" => "10"
]
2 => array:3 [
"email" => "test3@email.com"
"report" => "Report 4"
"count" => "0"
]
]
Here's what I got so far. The array is stored in $items
variable.
foreach ($items as $item) {
Mail::send('emails.test', [ 'item' => $item ], function ($m) use($item) {
$m->bcc('test0@mail.com');
$m->to($item['email'])->subject($item['report']);
});
}
It sends the first 2 reports, but I get an error "too many emails per second". How can I avoid these error? or Is there a better approach?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire