protected function UserMailQueueJob::sendMail in Open Social 10.2.x
Same name and namespace in other branches
- 10.3.x modules/social_features/social_user/src/Plugin/AdvancedQueue/JobType/UserMailQueueJob.php \Drupal\social_user\Plugin\AdvancedQueue\JobType\UserMailQueueJob::sendMail()
- 10.1.x modules/social_features/social_user/src/Plugin/AdvancedQueue/JobType/UserMailQueueJob.php \Drupal\social_user\Plugin\AdvancedQueue\JobType\UserMailQueueJob::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 UserMailQueueJob::sendMail()
- UserMailQueueJob::process in modules/
social_features/ social_user/ src/ Plugin/ AdvancedQueue/ JobType/ UserMailQueueJob.php
File
- modules/
social_features/ social_user/ src/ Plugin/ AdvancedQueue/ JobType/ UserMailQueueJob.php, line 167
Class
- UserMailQueueJob
- Advanced Queue Job to process email to users.
Namespace
Drupal\social_user\Plugin\AdvancedQueue\JobTypeCode
protected function sendMail(string $user_mail, string $langcode, QueueStorageEntity $mail_params, $display_name = NULL) {
$subject = $mail_params
->get('field_subject')
->getValue();
$message = $mail_params
->get('field_message')
->getValue();
$reply_to = $mail_params
->get('field_reply_to')
->getValue();
$reply = NULL;
if (!empty($reply_to)) {
$reply = $reply_to[0]['value'];
}
$context = [
'subject' => $subject[0]['value'],
'message' => $message[0]['value'],
];
if ($display_name) {
$context['display_name'] = $display_name;
}
// Attempt sending mail.
$this->mailManager
->mail('system', 'action_send_email', $user_mail, $langcode, [
'context' => $context,
], $reply);
}