I know I used an older version of Moodle (3.5.1), but maybe someone has an idea for a solution.
In the classroom we have a forum
type: standard forum for general use
subscription: Forced subscription
restrict access: User profile field x is equal to value
=> Check subscribers list: okay (Example 5 Users, 3 Trainer, 2 Studenten)
=> Add a new discussion topic: okay
=> sending email: only to users in the role of trainer (3x), no email to participants (2) in subscribers list
The email delivery to the students works fine in other forums without restrictions
Greetings Jörg