Skip to content

Instantly share code, notes, and snippets.

@rcarvs
Last active October 1, 2019 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcarvs/1c40c4258f001b03d3c281edad912024 to your computer and use it in GitHub Desktop.
Save rcarvs/1c40c4258f001b03d3c281edad912024 to your computer and use it in GitHub Desktop.
The sequential dumb strategy for send a list of e-mails continuously
<?php
$emailsList = News::giveMeNumberAvaiableEmailsAndMarkAsSending($numberOfEmails);
foreach ($emailsList as $email) {
try {
//This task delay seconds and this is bad
$send = $email->send();
$email->markAsSend();
} catch (\Exception $e) {
$email->markAsFailure($e->getMessage());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment