You are here

public static function HtmlMailHelper::htmlMailIsAllowed in HTML Mail 8

Same name and namespace in other branches
  1. 8.3 src/Helper/HtmlMailHelper.php \Drupal\htmlmail\Helper\HtmlMailHelper::htmlMailIsAllowed()

Checks whether a given recipient email prefers plaintext-only messages.

Parameters

string $email: The recipient email address.

Return value

bool FALSE if the recipient prefers plaintext-only messages; otherwise TRUE.

1 call to HtmlMailHelper::htmlMailIsAllowed()
HTMLMailSystem::format in src/Plugin/Mail/HTMLMailSystem.php
Format emails according to module settings.

File

src/Helper/HtmlMailHelper.php, line 93

Class

HtmlMailHelper
Class HtmlMailHelper.

Namespace

Drupal\htmlmail\Helper

Code

public static function htmlMailIsAllowed($email) {
  return !($recipient = user_load_by_mail($email)) || empty(\Drupal::service('user.data')
    ->get(self::HTMLMAIL_MODULE_NAME, $recipient
    ->id(), self::HTMLMAIL_USER_DATA_NAME));
}