Laravel Mailing

Single Email With Multiple Recipients

1$emailRecipient = ['email01@example.com', 'email02@example.com'];
2Mail::to($emailRecipient)->send(new MailOnServiceFailure($logTimestamp, $failedContent));
3Log::info("Service Failure Mail Alert sent successfully to " . json_encode($emailRecipient));

Single Email Per Recipients

1$emailRecipient = ['email01@example.com', 'email02@example.com'];
2foreach ($emailRecipient as $eachEmail) {
3    Mail::to($eachEmail)->send(new MailOnServiceFailure($logTimestamp, $failedContent);
4    Log::info("Service Failure Mail Alert sent successfully to  {$eachEmail}.");
5}

Posts in this Series