function SendAccountEmail::doExecute
Send account email.
Parameters
\Drupal\user\UserInterface $user: User who should receive the notification.
string $email_type: Type of email to be sent.
File
-
src/
Plugin/ RulesAction/ SendAccountEmail.php, line 77
Class
- SendAccountEmail
- Provides a 'Send account email' action.
Namespace
Drupal\rules\Plugin\RulesActionCode
protected function doExecute(UserInterface $user, $email_type) {
$message = _user_mail_notify($email_type, $user);
// Log the success or failure.
if (!$message['result']) {
$this->logger
->notice('%type email sent to %recipient.', [
'%type' => $email_type,
'%recipient' => $user->mail,
]);
}
else {
$this->logger
->error('Failed to send %type email to %recipient.', [
'%type' => $email_type,
'%recipient' => $user->mail,
]);
}
}