To clarify, the user must have the capability "moodle/site:sendmessage" on the system context. There are multiple ways to control this. Granting this capability for the Authenticated user gives it to everyone. If you want to allow messaging to staff only, create a new role such as "Message sender" with the capability enabled (and unset it from all other roles). Assign the new role at Site administration > Users > Permissions > Assign system roles to staff members only. You can't simply use the Teacher role for this as that one is typically assigned on lower course level context, not globally. See e.g. https://docs.moodle.org/en/Context#Roles_and_contexts for details.
Roles and permissions
Teachers unable to send messages to students - Sorry, but you do not currently have permissions to do that (Send messages to any user)
This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.