protected function MailgunHandler::getRecipients in Mailgun 8
Returns a list of recipients for error/debug log message.
Parameters
array $mailgunMessage: A message array, as described in https://documentation.mailgun.com/en/latest/api-sending.html#sending.
Return value
string Recipients list in the following format: user@test.com, user1@test.com; cc: user2@test.com; bcc: user3@test.com.
1 call to MailgunHandler::getRecipients()
- MailgunHandler::sendMail in src/
MailgunHandler.php - Connects to Mailgun API and sends out the email.
File
- src/
MailgunHandler.php, line 257
Class
- MailgunHandler
- Mail handler to send out an email message array to the Mailgun API.
Namespace
Drupal\mailgunCode
protected function getRecipients(array $mailgunMessage) {
$recipients = is_array($mailgunMessage['to']) ? implode(', ', $mailgunMessage['to']) : $mailgunMessage['to'];
// Add all recipients (including 'cc' and 'bcc').
foreach ([
'cc',
'bcc',
] as $parameter) {
if (!empty($mailgunMessage[$parameter])) {
$recipients .= "; {$parameter}: {$mailgunMessage[$parameter]}";
}
}
return $recipients;
}