<pre><code>foreach(\craft\elements\User::find()-&gt;status('pending')-&gt;all() as $user){ 
    Craft::$app-&gt;getUsers()-&gt;sendActivationEmail($user);
}
</code></pre>

<p>Fetch all pending users and send them the mail </p>

CC BY-SA 4.0
2018-07-02T08:05:19.620Z
To clarify for anyone landing here via Google: the solution here is a code snippet to be applied as a plugin - which you'd need to make yourself. There is no built in action in the CMS to do as requested, and the above line is not Twig code to be put in a template.
Matt Wilcox
CC BY-SA 4.0
2018-07-02T08:06:02.143Z
@MattWilcox To clarify, it can be done in Twig as well
Robin Schambach
CC BY-SA 4.0
2020-01-16T14:19:01.833Z
What is the alternative solution in Twig or via control panel? I am also looking for this solution.
Neftali Loria
CC BY-SA 4.0
2018-06-24T08:33:36.607Z
2018-06-24T08:33:36.607Z
Robin Schambach
<p>I have around 200 hundred users for an intranet setup on the Craft Users section all as pending status. Is there a way to send an activation email en-mass to all pending users? Rather than having to run through each user one at a time. </p>

<p>The system is set to change over and each user will need to verify their account and set their password, but they've been added to the system in advance and need to be sent an activation email out of hours so that they Intranet system changes overnight and they have an email waiting for them the next day they step into the office.</p>

<users><activation>
Sending activation emails to all pending users
# Sending activation emails to all pending users

(Asked by: username_0 on 2018-06-24)

I have around 200 hundred users for an intranet setup on the Craft Users section all as pending status. Is there a way to send an activation email en-mass to all pending users? Rather than having to run through each user one at a time.

The system is set to change over and each user will need to verify their account and set their password, but they've been added to the system in advance and need to be sent an activation email out of hours so that they Intranet system changes overnight and they have an email waiting for them the next day they step into the office.

**Tags:** users, activation

---

## 1 answers

### Answer by username_1 on 2018-06-24. Score: 5 | Accepted answer

foreach(\craft\elements\User::find()->status('pending')->all() as $user){ 
    Craft::$app->getUsers()->sendActivationEmail($user);
}

Fetch all pending users and send them the mail

> **Comments:**
> **username_2**: To clarify for anyone landing here via Google: the solution here is a code snippet to be applied as a plugin - which you'd need to make yourself. There is no built in action in the CMS to do as requested, and the above line is not Twig code to be put in a template.  
> **username_1**: @MattWilcox To clarify, it can be done in Twig as well  
> **username_3**: What is the alternative solution in Twig or via control panel? I am also looking for this solution.  

---

