diff --git a/zerver/management/commands/send_custom_email.py b/zerver/management/commands/send_custom_email.py index 5947fd5b99..3dc2c79ad3 100644 --- a/zerver/management/commands/send_custom_email.py +++ b/zerver/management/commands/send_custom_email.py @@ -1,6 +1,8 @@ from argparse import ArgumentParser from typing import Any +from django.conf import settings + from zerver.lib.management import CommandError, ZulipBaseCommand from zerver.lib.send_email import send_custom_email from zerver.models import Realm, UserProfile @@ -86,6 +88,9 @@ class Command(ZulipBaseCommand): ) raise error + # Only email users who've agreed to the terms of service. + if settings.TOS_VERSION is not None: + users = users.exclude(tos_version=None) send_custom_email(users, options) if options["dry_run"]: