You are here

protected function UserMailQueueProcessor::sendMail in Open Social 10.1.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php \Drupal\social_user\Plugin\QueueWorker\UserMailQueueProcessor::sendMail()
  2. 8.8 modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php \Drupal\social_user\Plugin\QueueWorker\UserMailQueueProcessor::sendMail()
  3. 10.3.x modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php \Drupal\social_user\Plugin\QueueWorker\UserMailQueueProcessor::sendMail()
  4. 10.0.x modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php \Drupal\social_user\Plugin\QueueWorker\UserMailQueueProcessor::sendMail()
  5. 10.2.x modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php \Drupal\social_user\Plugin\QueueWorker\UserMailQueueProcessor::sendMail()

Send the email.

Parameters

string $user_mail: The recipient email address.

string $langcode: The recipient language.

\Drupal\social_queue_storage\Entity\QueueStorageEntity $mail_params: The email content from the storage entity.

string $display_name: In case of anonymous users a display name will be given.

1 call to UserMailQueueProcessor::sendMail()
UserMailQueueProcessor::processItem in modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php
Works on a single queue item.

File

modules/social_features/social_user/src/Plugin/QueueWorker/UserMailQueueProcessor.php, line 163

Class

UserMailQueueProcessor
Queue worker to process email to users.

Namespace

Drupal\social_user\Plugin\QueueWorker

Code

protected function sendMail(string $user_mail, string $langcode, QueueStorageEntity $mail_params, $display_name = NULL) {
  $context = [
    'subject' => $mail_params
      ->get('field_subject')->value,
    'message' => $mail_params
      ->get('field_message')->value,
  ];
  if ($display_name) {
    $context['display_name'] = $display_name;
  }

  // Attempt sending mail.
  $this->mailManager
    ->mail('system', 'action_send_email', $user_mail, $langcode, [
    'context' => $context,
  ], $mail_params
    ->get('field_reply_to')->value);
}