You are here

interface MailgunHandlerInterface in Mailgun 8

The interface for Mailgun handler service.

Hierarchy

Expanded class hierarchy of MailgunHandlerInterface

All classes that implement MailgunHandlerInterface

8 files declare their use of MailgunHandlerInterface
mailgun.install in ./mailgun.install
Contains install/uninstall stuff.
MailgunAdminSettingsForm.php in src/Form/MailgunAdminSettingsForm.php
MailgunAdminSettingsFormTest.php in tests/src/Functional/MailgunAdminSettingsFormTest.php
MailgunFunctionalTestBase.php in tests/src/Functional/MailgunFunctionalTestBase.php
MailgunKernelTestBase.php in tests/src/Kernel/MailgunKernelTestBase.php

... See full list

File

src/MailgunHandlerInterface.php, line 8

Namespace

Drupal\mailgun
View source
interface MailgunHandlerInterface {
  const CONFIG_NAME = 'mailgun.settings';

  /**
   * Connects to Mailgun API and sends out the email.
   *
   * @param array $mailgunMessage
   *   A message array, as described in
   *   https://documentation.mailgun.com/en/latest/api-sending.html#sending.
   *
   * @return bool
   *   TRUE if the mail was successfully accepted by the API, FALSE otherwise.
   *
   * @see https://documentation.mailgun.com/en/latest/api-sending.html#sending
   */
  public function sendMail(array $mailgunMessage);

  /**
   * Returns domains list from API.
   *
   * @return array
   *   Returns the list of domains. Both array keys and values are domain names,
   *   E.g.:
   *   [
   *     'domain.name' => 'domain.name',
   *   ]
   */
  public function getDomains();

  /**
   * Parses and returns domain based on the email "From" value.
   *
   * @param string $from
   *   "From" parameter of the mail message.
   *
   * @return string|bool
   *   Returns domain name or FALSE if we couldn't parse it.
   */
  public function getDomain($from);

  /**
   * Validates Mailgun library and API settings.
   *
   * @param bool $showMessage
   *   Whether error messages should be shown.
   *
   * @return bool
   *   Whether the library installed and API settings are ok.
   */
  public function moduleStatus($showMessage = FALSE);

  /**
   * Validates Mailgun API key.
   *
   * @param string $key
   *   The API key.
   *
   * @return bool
   *   Whether the API key is valid.
   */
  public function validateMailgunApiKey($key);

  /**
   * Checks if API settings are correct and not empty.
   *
   * @param bool $showMessage
   *   Whether error messages should be shown.
   *
   * @return bool
   *   Whether API settings are valid.
   */
  public function validateMailgunApiSettings($showMessage = FALSE);

  /**
   * Checks if Mailgun PHP SDK is installed correctly.
   *
   * @param bool $showMessage
   *   Whether error messages should be shown.
   *
   * @return bool
   *   Whether the Mailgun PHP SDK is installed correctly.
   */
  public function validateMailgunLibrary($showMessage = FALSE);

}

Members

Namesort descending Modifiers Type Description Overrides
MailgunHandlerInterface::CONFIG_NAME constant
MailgunHandlerInterface::getDomain public function Parses and returns domain based on the email "From" value. 1
MailgunHandlerInterface::getDomains public function Returns domains list from API. 1
MailgunHandlerInterface::moduleStatus public function Validates Mailgun library and API settings. 1
MailgunHandlerInterface::sendMail public function Connects to Mailgun API and sends out the email. 1
MailgunHandlerInterface::validateMailgunApiKey public function Validates Mailgun API key. 1
MailgunHandlerInterface::validateMailgunApiSettings public function Checks if API settings are correct and not empty. 1
MailgunHandlerInterface::validateMailgunLibrary public function Checks if Mailgun PHP SDK is installed correctly. 1