You are here

public function OrphanProcessor::sendOrphanedAccountsMail in Lightweight Directory Access Protocol (LDAP) 8.3

Same name and namespace in other branches
  1. 8.4 ldap_user/src/Processor/OrphanProcessor.php \Drupal\ldap_user\Processor\OrphanProcessor::sendOrphanedAccountsMail()

Send email.

1 call to OrphanProcessor::sendOrphanedAccountsMail()
OrphanProcessor::checkOrphans in ldap_user/src/Processor/OrphanProcessor.php
Check for Drupal accounts which no longer have a related LDAP entry.

File

ldap_user/src/Processor/OrphanProcessor.php, line 110

Class

OrphanProcessor
Locates potential orphan user accounts.

Namespace

Drupal\ldap_user\Processor

Code

public function sendOrphanedAccountsMail() {
  $to = $this->configFactory
    ->get('system.site')
    ->get('mail');
  $siteLanguage = $this->languageManager
    ->getCurrentLanguage()
    ->getId();
  $params = [
    'accounts' => $this->emailList,
  ];
  $result = $this->mailManager
    ->mail('ldap_user', 'orphaned_accounts', $to, $siteLanguage, $params, NULL, TRUE);
  if (!$result) {
    $this->logger
      ->error('Could not send orphaned LDAP accounts notification.');
  }
}