How to set all users notifying email preferences to none?

update: thank you very much! Just ran it,

first checked in admin CP which users would be affected, I only needed myself active for now. So last active was 50 days or so (and I had been active for the last days), so 50 days was the cut off point.

Since I’m lazy and didn’t want to calculate much, I adapted the date to 2020-01-01 and ran the script,

and presto, 25400 users from active to inactive.

also: it excludes discobot and system user, they remain active. (which makes sense and I’m glad it is programmed this way :slight_smile: )