You are here

public function MandrillAPI::getSender in Mandrill 8

Gets a single sender.

Parameters

string $email: The email address of the sender.

Return value

array The sender information.

Overrides MandrillAPIInterface::getSender

File

src/MandrillAPI.php, line 268

Class

MandrillAPI
Service class to integrate with Mandrill.

Namespace

Drupal\mandrill

Code

public function getSender($email) {
  $sender = NULL;
  try {
    if ($mandrill = $this
      ->getAPIObject()) {
      $sender = $mandrill->senders
        ->info($email);
    }
  } catch (\Exception $e) {
    \Drupal::messenger()
      ->addError(t('Mandrill: %message', array(
      '%message' => $e
        ->getMessage(),
    )));
    $this->log
      ->error($e
      ->getMessage());
  }
  return $sender;
}