You are here

public static function SendinblueManager::getSenderList in SendinBlue 7

Get sender list.

Return value

array An array of senders.

File

includes/sendinblue.manage.inc, line 446
Manage class file.

Class

SendinblueManager
Basic manager of module.

Code

public static function getSenderList() {
  $access_key = variable_get(self::ACCESS_KEY, '');
  $mailin = new SendinblueMailin(self::API_URL, $access_key);
  $response = $mailin
    ->getSenders('');
  $senders = array(
    array(
      'id' => '-1',
      'name' => 'Default',
    ),
  );
  if ($response['code'] == 'success' && is_array($response['data'])) {
    foreach ($response['data'] as $sender) {
      $senders[] = array(
        'id' => $sender['from_email'],
        'name' => $sender['from_email'],
      );
    }
  }
  return $senders;
}