4.11.0: can't set new user passwords, but user invite emails not sent

Hi all
Version 4.11.0 changed the way users are created: You can’t set their password as Admin anymore, instead there is an invite email sent to new users. So far so good, i understand why this has changed.

However, my matomo isn’t sending invite emails. Or at least they don’t arrive. I know, there are many things that can cause this, so i am trying to narrow it.

I tried with local mail() and with gmail server: no errors, no mails.

2 questions:

  • has anybody found a solution to still create new users incl. passwords as an admin? the API should work, but i couldn’t make it work. Maybe someone has a code example for this using UsersManager.addUser?

  • any idea what’s wrong with mail setup? i used settings from google help (smtp.gmail.com, TLS, port 587)

ty!

Hi,

For debugging the broken E-Mail I recommend a combination of https://matomo.org/faq/troubleshooting/faq_34856/ (to see if the sending part works) and https://www.mail-tester.com/ (to see if the mailserver is set up correctly).

For the API, can you share the request that isn’t working correctly?

And you are right that this isn’t ideal at the moment. I wrote down some thought here:

1 Like

@soardiac

If you wanted to test your mail server, you can use the included console command for testing emails, for example:

./console core:test-email emailHere@example.com

As a workaround for now you can use the API method to create new users. Since there isn’t an example, I wrote one that can be used below.

If you wanted to simply use your browser, then you can do a simple GET request by replacing the values below with the ones you want to set for your user. It’s important to remember that the email and password both need to be URL Encoded.

https://your-matomo-url.com/index.php?module=API&method=UsersManager.addUser&userLogin=UserNameHere&email=url-encoded-email%40example.com&password=URL-encoded-password&initialIdSite=1&token_auth=your-token-auth-here

However, since this is a GET request, it will be stored in both your browsers history as well as the web server access logs, so you could instead send a POST request using something such as cURL:

curl -X POST -d 'module=API&method=UsersManager.addUser&userLogin=UserNameHere&email=url-encoded-email%40example.com&password=URL-encoded-password&initialIdSite=1&token_auth=your-token-auth-here' https://your-matomo-url.com/index.php
1 Like

Thank you @rstark, that worked perfectly!