Exemple #1
0
def send_email_to_admins(
    template_prefix: str,
    realm: Realm,
    from_name: Optional[str] = None,
    from_address: Optional[str] = None,
    language: Optional[str] = None,
    context: Dict[str, Any] = {},
) -> None:
    admins = realm.get_human_admin_users()
    admin_user_ids = [admin.id for admin in admins]
    send_email(
        template_prefix,
        to_user_ids=admin_user_ids,
        from_name=from_name,
        from_address=from_address,
        language=language,
        context=context,
    )
Exemple #2
0
 def get_realm_admin_emails_as_string(realm: Realm) -> str:
     return ", ".join(
         realm.get_human_admin_users(include_realm_owners=False).order_by(
             "delivery_email").values_list("delivery_email", flat=True))