+ # Send digest only to active users
+ if settings.SEND_DIGEST_ONLY_TO_ACTIVE_USERS:
+ users = users.filter(is_active=True)
+
+ # Send digest only to users with validated emails
+ if settings.SEND_DIGEST_ONLY_TO_VALIDATED_USERS:
+ users = users.filter(email_isvalid=True)