Returns a mail string for a variable name.
string $key: The config key that provides the mail text.
string $langcode: (optional) A language code to use to generate the e-mail text.
array $variables: (optional) An array of token keys and values.
A string value containing the text for the user.mail config key.
function _user_mail_text($key, $langcode = NULL, $variables = array()) {
// We do not sanitize the token replacement, since the output of this
// replacement is intended for an e-mail message, not a web browser.
return token_replace(config('user.mail')
->get($key), $variables, array(
'langcode' => $langcode,
'callback' => 'user_mail_tokens',
'sanitize' => FALSE,
'clear' => TRUE,
));
}