- Issue created by @Rob230
- 🇬🇧United Kingdom Rob230
I don't actually know how to make this work, since the Drupal core MailInterface
mail()
returns a bool and only takes one argument that isn't passed by reference. There's no way to get this information out.I still don't think it makes sense for
Service::handleSendResponse()
to return FALSE in a loop. Potentially what happens is it queues multiple emails and logs each one as being queued, and then as soon as it encounters a rejected one, returns FALSE and acts like the whole thing was a failure (despite multiple emails being sent).What I was thinking is it should capture errors in an array, but don't return and keep looping. Then when the loop completes if
$errors
contains anything it can return false. But there's no way to surface these errors so I'm a bit stuck. I don't think the DrupalMailInterface
was ever designed for sending to multiple recipients one at a time in a single operation.The only thing I can think of is to not treat "rejected" as an error at all. Technically Mailchimp tried, and no it wasn't successful but there's no point trying again. The rejection should be logged but it shouldn't be considered a failed send by the
mail()
function.