What is the best way to filter emails in gmail from a long list of senders?

I’m a technology administrator at a small school using GSuite, and I would like to filter all emails coming from students into a specific folder. Right now we have 95 students (only a freshman class,) but that will eventually get up to around 400. In GSuite, they are all in the same organizational unit, but I haven’t found a way to filter based on that. Thoughts?

I’m assuming they are not coming from the same domain name, or you don’t want to filter just on domain name? Because otherwise you could just search for “@your.domain.here.edu” and create a filter from that.

I think it would be that there are others within the same domain (teachers, administrative staff, custodial staff, etc.) that are in different organisational units that are not to be filtered in such a way.

There must be a better way to do this, but when I needed to do this in the past, I had a text document with all of the email addresses, each on its own line.

Then I had a script I could run which would change that into a very long “OR” chain that I could paste into Gmail’s search box:

from:user@example.com OR from:person@place.edu OR from:another@domain.tld

I would use that to search in Gmail and then click the option for “Create a Filter Based on this Search”.

Then if I needed to add someone to that, I could just edit the filter and add their name at the front of the filter as from:newbie@whatever.xzy OR and paste that at the front of the list that was already there.

As I said, there must be a better way, but that’s what I did several years ago and it worked for me.

The issue is then that the rules need to be maintained manually. The OP already has a grouping defined within GSuite, but doesn’t seem to be able to apply that grouping as part of a rule.

If the rules are manually managed, then they would have to be maintained alongside the usual admin resulting in duplication of effort.

I don’t have GSuite admin access, so I can’t verify the behaviour, but:

My first thought was adding something to a mail footer for all org unit members and filtering on that, but it wouldn’t be guaranteed to work correctly for anything after the first inbound thread in a mail and if that was a forward, e.g. student to teacher to admin, not even then

An alternative, and I admit this is heavy handed, would be to assign students something in their e-mail address that could be filtered on.

For example, a student e-mail address could be john.smith-student@academy.edu or john.smith@student.academy.edu. Then you could tailor your rule to filter on a name suffix or sub-domain.

As I say, heavy handed, but I think if it really isn’t possible to filter on the org unit internally, then the only reliable data point would be the sender’s e-mail address; in which case a common marker would be needed.