You are here

interface MailInterface in Simplenews 3.x

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

A newsletter mail.

Hierarchy

Expanded class hierarchy of MailInterface

All classes that implement MailInterface

File

src/Mail/MailInterface.php, line 10

Namespace

Drupal\simplenews\Mail
View source
interface MailInterface {

  /**
   * Returns the newsletter issue entity.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface
   *   Newsletter issue entity.
   */
  public function getIssue();

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

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

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

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

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

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

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

  /**
   * The language that should be used for this newsletter mail.
   *
   * @return string
   *   The langcode.
   */
  public 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.
   */
  public function getAttachments();

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

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

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

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

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

}

Members

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