diff -ru a/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php commerce_stock_notifications/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php --- a/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php 2026-10-04 13:29:53.061304008 +0200 +++ b/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php 2026-10-05 12:15:56.999055009 +0200 @@ -120,23 +120,31 @@ } // Parameters that will be used during the mailing procedure. - $subject = $this->token->replace(AdminConfigForm::getValuesFromConfig()['email_subject'], [ + $subject = $this->token->replacePlain(AdminConfigForm::getValuesFromConfig()['email_subject'], [ 'commerce_product_variation' => $variation, 'user' => $user, ]); - $message = $this->token->replace(AdminConfigForm::getValuesFromConfig()['email_body'], [ + $message = $this->token->replacePlain(AdminConfigForm::getValuesFromConfig()['email_body'], [ 'commerce_product_variation' => $variation, 'user' => $user, ]); $build = [ '#theme' => 'commerce_stock_notifications_message', - '#message' => $message, + // The e-mail body is plain text: escape it, convert line breaks and + // turn URLs into links. + '#message' => [ + '#type' => 'processed_text', + '#text' => $message, + '#format' => 'plain_text', + ], '#commerce_product_variation' => $variation, '#commerce_product_variation_url' => $variation->toUrl(), '#user' => $user, '#mail' => $data->getEmail(), ]; - $body = (string) DeprecationHelper::backwardsCompatibleCall( + // Keep the rendered markup: a plain string would be treated as plain + // text by the mail system, and the HTML wrapper would be escaped. + $body = DeprecationHelper::backwardsCompatibleCall( \Drupal::VERSION, '10.3.0', fn () => $this->renderer->renderInIsolation($build), fn () => $this->renderer->renderPlain($build),