You are here

interface MailInterface in Simplenews 8

Same name and namespace in other branches
  1. 8.2 src/Mail/MailInterface.php \Drupal\simplenews\Mail\MailInterface
  2. 3.x src/Mail/MailInterface.php \Drupal\simplenews\Mail\MailInterface

A newsletter mail.

Hierarchy

Expanded class hierarchy of MailInterface

All classes that implement MailInterface

3 files declare their use of MailInterface
MailBuilder.php in src/Mail/MailBuilder.php
Mailer.php in src/Mail/Mailer.php
MailerInterface.php in src/Mail/MailerInterface.php

File

src/Mail/MailInterface.php, line 10

Namespace

Drupal\simplenews\Mail
View source
interface MailInterface {

  /**
   * Returns the used entity for this mail.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface
   */
  function getEntity();

  /**
   * Returns the subscriber object.
   *
   * @return \Drupal\simplenews\SubscriberInterface
   */
  function getSubscriber();

  /**
   * Returns the mail headers.
   *
   * @param $headers
   *   The default mail headers.
   *
   * @return
   *   Mail headers as an array.
   */
  function getHeaders(array $headers);

  /**
   * Returns the mail subject.
   *
   * @return string
   *   The mail subject.
   */
  function getSubject();

  /**
   * Returns the mail body.
   *
   * @return string
   *   The body, as plaintext or html depending on the format.
   */
  function getBody();

  /**
   * Returns the plaintext body.
   *
   * @return string
   *   The body as plain text.
   */
  function getPlainBody();

  /**
   * Returns the mail format.
   *
   * @return string
   *   The mail format as string, either 'plain' or 'html'.
   */
  function getFormat();

  /**
   * Returns the recipient of this newsletter mail.
   *
   * @return string
   *   The recipient mail address(es) of this newsletter as a string.
   */
  function getRecipient();

  /**
   * The language that should be used for this newsletter mail.
   *
   * @return string
   *   The langcode.
   */
  function getLanguage();

  /**
   * Returns an array of attachments for this newsletter mail.
   *
   * @return array
   *   An array of managed file objects with properties uri, filemime and so on.
   */
  function getAttachments();

  /**
   * Returns the token context to be used with token replacements.
   *
   * @return array
   *   An array of objects as required by token_replace().
   */
  function getTokenContext();

  /**
   * Returns the mail key to be used for mails.
   *
   * @return string
   *   The mail key, either test or node.
   */
  function getKey();

  /**
   * Set the mail key.
   *
   * @param string $key
   *   The mail key, either 'test' or 'node'.
   */
  function setKey($key);

  /**
   * Returns the formatted from mail address.
   *
   * @return string
   *   The mail address with a name.
   */
  function getFromFormatted();

  /**
   * Returns the plain mail address.
   *
   * @return string
   *   The mail address.
   */
  function getFromAddress();

}

Members

Namesort descending Modifiers Type Description Overrides
MailInterface::getAttachments function Returns an array of attachments for this newsletter mail. 2
MailInterface::getBody function Returns the mail body. 2
MailInterface::getEntity function Returns the used entity for this mail. 2
MailInterface::getFormat function Returns the mail format. 2
MailInterface::getFromAddress function Returns the plain mail address. 2
MailInterface::getFromFormatted function Returns the formatted from mail address. 2
MailInterface::getHeaders function Returns the mail headers. 2
MailInterface::getKey function Returns the mail key to be used for mails. 2
MailInterface::getLanguage function The language that should be used for this newsletter mail. 2
MailInterface::getPlainBody function Returns the plaintext body. 2
MailInterface::getRecipient function Returns the recipient of this newsletter mail. 2
MailInterface::getSubject function Returns the mail subject. 2
MailInterface::getSubscriber function Returns the subscriber object. 2
MailInterface::getTokenContext function Returns the token context to be used with token replacements. 2
MailInterface::setKey function Set the mail key. 2