You are here

public function MailBuilder::buildValidateMail in Simplenews 3.x

Build subject and body of the validate email.

Parameters

array $message: Message array as used by hook_mail().

array $params: Parameter array as used by hook_mail().

Overrides MailBuilderInterface::buildValidateMail

File

src/Mail/MailBuilder.php, line 124

Class

MailBuilder
Default mail builder.

Namespace

Drupal\simplenews\Mail

Code

public function buildValidateMail(array &$message, array $params) {
  $context = $params['context'];

  // Use formatted from address "name" <mail_address>.
  $message['headers']['From'] = $params['from']['formatted'];
  $message['subject'] = $this->config
    ->get('subscription.validate_subject');
  $message['subject'] = simplenews_token_replace_subject($message['subject'], $context);
  $body = $this->config
    ->get('subscription.validate_body');
  $message['body'][] = simplenews_token_replace_body($body, $context);
}