public static function LearningPathAccess::sendMail in Opigno Learning path 8
Same name and namespace in other branches
- 3.x src/LearningPathAccess.php \Drupal\opigno_learning_path\LearningPathAccess::sendMail()
Sends mail.
1 call to LearningPathAccess::sendMail()
- LearningPathAccess::notifyUsersByMail in src/
LearningPathAccess.php - Prepares and sends emails to users.
File
- src/
LearningPathAccess.php, line 479
Class
- LearningPathAccess
- Class LearningPathAccess.
Namespace
Drupal\opigno_learning_pathCode
public static function sendMail($to, $subject, $message, $params = []) {
$langcode = \Drupal::currentUser()
->getPreferredLangcode();
$mailManager = \Drupal::service('plugin.manager.mail');
$module = 'opigno_learning_path';
$key = 'opigno_learning_path_user_subscribe';
$params['subject'] = $subject;
$params['message'] = $message;
$send = TRUE;
$result = $mailManager
->mail($module, $key, $to, $langcode, $params, NULL, $send);
return $result['result'];
}