# How to manually add users and email in console mode?

**URL:** <https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669>\
**Category:** Product Support\
**Created:** [March 23, 2015, 2:16pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669 "2015-03-23T14:16:43Z")\
**Posts on this page:** 14\
**Page:** 1

## AI-generated summary

Users discuss how to manually add users and assign emails via the Discourse console. [doudou](/t/-/26669/1) asks how to create users like `rake admin:create` after entering the Docker container. [elberet](/t/-/26669/2) provides a Ruby snippet using `rails c` to create users, approve, and activate them — adding `admin: true` for admin roles. [sam](/t/-/26669/4) suggests `rake admin:invite` for inviting admins. [trudat](/t/-/26669/5) asks if new users receive emails — [riking](/t/-/26669/6) advises disabling email via site settings to suppress welcome messages. [Jared_Needell](/t/-/26669/7) seeks a script for bulk users; [tonycurzonprice](/t/-/26669/8) shares a Google Sheets + CSV workaround using `load './mail-import.rb'` to automate creation. [tonycurzonprice](/t/-/26669/9) and [nordize](/t/-/26669/14) note that users added via console don’t trigger welcome emails, even if the setting is enabled — unlike web-created users. [optimus](/t/-/26669/12) asks about assigning users to groups via command — no direct solution is given. [thaidb](/t/-/26669/13) suggests workarounds using invite links. The core issue remains: console-created users are not flagged as "new" for welcome emails, despite correct email settings.

<div class="post-metadata">

**Author:** ![doudou](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@doudou](https://meta.discourse.org/u/doudou)\
**Post date:** [March 23, 2015, 2:16pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/1 "2015-03-23T14:16:44Z")

</div>

I setup a localhost for test discourse. When I run

`./launcher enter app`

to get into the docker as root

how can I add discourse users and emails like

`rake admin:create`

?

Thanks.

---

<div class="post-metadata">

**Author:** ![elberet](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/elberet/32/122404_2.png) [@elberet](https://meta.discourse.org/u/elberet)\
**Post date:** [March 23, 2015, 3:25pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/2 "2015-03-23T15:25:53Z")

</div>

```ruby
rails c
u = User.create!(username: "name", email: "name@email.com", password: "password")
u.approve(Discourse.system_user, false) # if manual approvals are required
u.activate

```

If the user should be an admin, add `, admin: true` to the create line inside the parentheses; likewise for moderators.

---

<div class="post-metadata">

**Author:** ![doudou](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@doudou](https://meta.discourse.org/u/doudou)\
**Post date:** [March 23, 2015, 3:42pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/3 "2015-03-23T15:42:49Z")

</div>

Great. It is ok.

Thanks

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [March 23, 2015, 10:51pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/4 "2015-03-23T22:51:38Z")

</div>

`rake admin:invite` is very useful for inviting admins.

---

<div class="post-metadata">

**Author:** ![trudat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/trudat/32/104354_2.png) [@trudat](https://meta.discourse.org/u/trudat)\
**Post date:** [June 30, 2015, 8:54pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/5 "2015-06-30T20:54:49Z")

</div>

Using this method, will the new user receive an invite email?  
I am setting up a SSO site and I want to create accounts for all of my existing users **without** them receiving any email.

---

<div class="post-metadata">

**Author:** ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)\
**Post date:** [July 1, 2015, 12:22am UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/6 "2015-07-01T00:22:27Z")

</div>

Turn on the disable\_email site setting before adding the users to suppress the welcome emails.

---

<div class="post-metadata">

**Author:** ![Jared\_Needell](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jared_needell/32/116554_2.png) [@Jared\_Needell](https://meta.discourse.org/u/Jared_Needell)\
**Post date:** [August 27, 2015, 7:48pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/7 "2015-08-27T19:48:32Z")

</div>

Anyone have a way to script this for multiple users?

---

<div class="post-metadata">

**Author:** ![tonycurzonprice](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@tonycurzonprice](https://meta.discourse.org/u/tonycurzonprice)\
**Post date:** [August 27, 2015, 9:12pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/8 "2015-08-27T21:12:52Z")

</div>

@Jared_Needell - I did a simple kludgey thing for multiple users:  
with a csv of all my users, I put them into a google sheet and created essentially this line for each entry with a string formula:

> =“u = User.create!(username: '”&B45&“', email: '”&A45&“', password: ‘xxx’, mailing\_list\_mode: ‘true’);u.approve(Discourse.system\_user, false) ; u.activate”

I then put the strings created into a file on the server (mail-import.rb), opened the console and typed:

> load ‘./mail-import.rb’

It worked a treat

---

<div class="post-metadata">

**Author:** ![tonycurzonprice](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@tonycurzonprice](https://meta.discourse.org/u/tonycurzonprice)\
**Post date:** [August 27, 2015, 9:19pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/9 "2015-08-27T21:19:27Z")

</div>

I do have a question about email notifications using this method.

I have added users through the console using the following commands:

> u = User.create!(username: ‘xx’, email: ‘xx@xx.com’, password: ‘xxx’, mailing\_list\_mode: ‘true’);u.approve(Discourse.system\_user, false) ; u.activate

I have enabled “Send all new users a welcome message with a quick start guide” in [http://forum.brickfield.org.uk/admin/site\_settings/category/uncategorized](http://forum.brickfield.org.uk/admin/site_settings/category/uncategorized)

However, emails are _not_ being sent to users being added in this way. They _are_ being sent to users I add through the web front end … (ie it’s not an email problem).

I want the users I add automatically to receive the welcome email - I am migrating a googlegroup and the welcome email will be useful in moving people. So does anyone know how I can alert the system to these added users being “new” users from the point of view of receiving the welcome message?

Thank you for any help

Tony

---

<div class="post-metadata">

**Author:** ![optimus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/optimus/32/39715_2.png) [@optimus](https://meta.discourse.org/u/optimus)\
**Post date:** [January 13, 2016, 4:23pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/12 "2016-01-13T16:23:57Z")

</div>

This is helpful! Is there a way to assign the user(s) to groups from command?

---

<div class="post-metadata">

**Author:** ![thaidb](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thaidb/32/68488_2.png) [@thaidb](https://meta.discourse.org/u/thaidb)\
**Post date:** [March 5, 2017, 7:07am UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/13 "2017-03-05T07:07:09Z")

</div>

we can send an invite user then copy link invite user and create user in other tab

---

<div class="post-metadata">

**Author:** ![nordize](https://avatars.discourse-cdn.com/v4/letter/n/c68b51/32.png) [@nordize](https://meta.discourse.org/u/nordize)\
**Post date:** [March 17, 2017, 4:07am UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/14 "2017-03-17T04:07:50Z")

</div>

I successfully used Jens Maier’s solution above, but there was no welcome email … I actually wanted a welcome email. Using the latest v1.8.0.beta7 with virtually default docker installation options and emails are working fine otherwise (I get a welcome email if I send an invite from the admin panel).

Any ideas?

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [May 15, 2019, 1:11pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/15 "2019-05-15T13:11:50Z")

</div>

Automatically bumped on May 15, 2019, 1:11pm UTC



---

<div class="post-metadata">

**Author:** ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)\
**Post date:** [May 15, 2019, 1:25pm UTC](https://meta.discourse.org/t/how-to-manually-add-users-and-email-in-console-mode/26669/16 "2019-05-15T13:25:53Z")

</div>

Closed on May 15, 2019, 1:25pm UTC


