How can I define the users email-address while adding a user via occ

HI,

How can the e-mail address of the user be entered when creating a user account via occ command?

Like the following example:

sudo -u apache php occ user:add
--display-name "Bastard Operator from Hell" --group "friends" --email
"bofh@mailserver.guru" bofh

I have to be able to enter the e-mail address somehow so that Nextcloud can send the invitation or password set mail automatically. If I enter the new user via the GUI, it works very well. But I don’t want to get tendosynovitis on my right mouse hand from the many clicks, but do it all from the console.

Any ideas?

Best regards
Django

Perhaps you could run this command immediately after creating the user?
sudo -u apache php occ user:setting bofh settings email "bofh@mailserver.guru"

2 Likes

Thank you very much for your advice - Wonderful, you give me a great idea! :star_struck:

Do you know how I can send this email “Welcome on board” with the link to the password to users I created with the command occ and assigned an email address. (If I create the user via the Admin GUI, it will be sent automatically - but how can I do this on the console with occ?

Well, I have now found a solution for myself and have killed two things.

I have written a small bash-script, which gets itself, username, full name, email address and group membership from a csv file, so that the user accounts are created and sends the user a message via email (plain text mail) with information about the first login and generation of a password.

So I also solved the problem with the unreadable HTML messages, which the recipients can’t read, because they have to use LotusNotes as MUA.

Thank you again for your decisive tip!

Hi could you send me the bash-script? @Django I have exactly the same problem especially to get the data from a csv file and then send the users welcome messages…

Thank you!

Hi,

We are having the same problem. Could you please provide your solution, if you still remember.
That would be great.

Regards

export OC_PASS=dummypassword-3n2rt478gbruf9wod
occ user:add --display-name="$display_name" -g cli-import --password-from-env "$username"
occ user:setting dude settings email "$email"