You are here

function mandrill_get_to in Mandrill 7.2

Same name and namespace in other branches
  1. 8 mandrill.module \mandrill_get_to()
  2. 6 mandrill.mail.inc \mandrill_get_to()
  3. 7 mandrill.module \mandrill_get_to()

Helper to generate an array of recipients.

Parameters

$message array: An array containing the email data.

Return value

array An array of email addresses.

2 calls to mandrill_get_to()
MandrillMailSystem::mail in lib/mandrill.mail.inc
Send the email message.
Mandrill_MessagesTest::sendTemplate in tests/includes/mandrill_messages_test.inc

File

./mandrill.module, line 637
Enables Drupal to send email directly through Mandrill.

Code

function mandrill_get_to($message) {

  // Turn comma-separated string of recipients into Mandrill-style array.
  // See https://mandrillapp.com/api/docs/messages.html for reference.
  $recipients = mandrill_map_mail_recipients($message['to']);

  // Add "cc" recipients to the list of primary recipients with tag "cc".
  // It will be later handled in Mandrill to set the right headers / recipients.
  if (!empty($message['headers']['Cc'])) {
    $recipients = array_merge($recipients, mandrill_map_mail_recipients($message['headers']['Cc'], 'cc'));
    unset($message['headers']['Cc']);
  }
  return $recipients;
}