You are here

public function MandrillService::send in Mandrill 8

Abstracts sending of messages, allowing queueing option.

Parameters

array $message: A message array formatted for Mandrill's sending API.

Return value

bool TRUE if no exception thrown.

Overrides MandrillServiceInterface::send

1 call to MandrillService::send()
MandrillTestService::send in src/MandrillTestService.php
Abstracts sending of messages using PHP's built-in mail() function instead of Mandrill's sending API.
2 methods override MandrillService::send()
MandrillTemplateService::send in modules/mandrill_template/src/MandrillTemplateService.php
Abstracts sending of messages, allowing queueing option.
MandrillTestService::send in src/MandrillTestService.php
Abstracts sending of messages using PHP's built-in mail() function instead of Mandrill's sending API.

File

src/MandrillService.php, line 142

Class

MandrillService
Mandrill Service.

Namespace

Drupal\mandrill

Code

public function send($message) {
  try {
    $response = $this->mandrill_api
      ->send($message);
    return $this
      ->handleSendResponse($response, $message);
  } catch (\Exception $e) {
    $this->log
      ->error('Error sending email from %from to %to. @code: @message', array(
      '%from' => $message['from_email'],
      '%to' => $message['to'],
      '@code' => $e
        ->getCode(),
      '@message' => $e
        ->getMessage(),
    ));
    return FALSE;
  }
}