Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-02T08:05:19.620Z
Answers.Text: 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.
Answers.UserDisplayName: Matt Wilcox
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-07-02T08:06:02.143Z
Answers.Text: @MattWilcox To clarify, it can be done in Twig as well
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-16T14:19:01.833Z
Answers.Text: What is the alternative solution in Twig or via control panel? I am also looking for this solution.
Answers.UserDisplayName: Neftali Loria
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-24T08:33:36.607Z
Answers.LastActivityDate: 2018-06-24T08:33:36.607Z
Answers.UserDisplayName: Robin Schambach
Body: <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>
  
Tags: <users><activation>
Title: Sending activation emails to all pending users
ThreadText: # 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**: @username_2 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.  
  
  ---
  
  