Sending activation emails to all pending users
foreach(\craft\elements\User::find()-&gt;status('pending')-&gt;all() as $user){ 
    Craft::$app-&gt;getUsers()-&gt;sendActivationEmail($user);
}


Fetch all pending users and send them the mail