You are here

public function UserEmailVerification::sendVerifyMailById in User email verification 8

Send "Verify your Email" mail to requested user.

Parameters

int $uid: User ID.

Return value

bool Action result.

Overrides UserEmailVerificationInterface::sendVerifyMailById

1 call to UserEmailVerification::sendVerifyMailById()
UserEmailVerification::remindUserById in src/UserEmailVerification.php
Reminds user about verification user by ID.

File

src/UserEmailVerification.php, line 404

Class

UserEmailVerification
User email verification helper service.

Namespace

Drupal\user_email_verification

Code

public function sendVerifyMailById($uid) {
  $user = $this->entityTypeManager
    ->getStorage('user')
    ->load($uid);
  if ($user instanceof UserInterface) {
    $mail = $this->mailManager
      ->mail('user_email_verification', 'verify', $user
      ->getEmail(), $user
      ->getPreferredLangcode(), [
      'user' => $user,
    ]);
    return $mail && isset($mail['result']) ? $mail['result'] : FALSE;
  }
  return FALSE;
}