You are here

public function MandrillAPI::addInboundRoute in Mandrill 8

Adds a new inbound route for a domain.

Parameters

string $domain: An existing inbound domain name.

string $pattern: The search pattern that the mailbox name should match.

string $url: The webhook URL where the inbound messages will be published.

Return value

array

Overrides MandrillAPIInterface::addInboundRoute

File

src/MandrillAPI.php, line 439

Class

MandrillAPI
Service class to integrate with Mandrill.

Namespace

Drupal\mandrill

Code

public function addInboundRoute($domain, $pattern, $url) {
  $result = NULL;
  try {
    if ($mandrill = $this
      ->getAPIObject()) {
      $result = $mandrill->inbound
        ->addRoute($domain, $pattern, $url);
    }
  } catch (\Exception $e) {
    \Drupal::messenger()
      ->addError(t('Mandrill: %message', array(
      '%message' => $e
        ->getMessage(),
    )));
    $this->log
      ->error($e
      ->getMessage());
  }
  return $result;
}