send_email: Improve configurability for outgoing email sender name.

Currently, the sender names for outgoing emails sent by Zulip
are hardcoded. It should be configurable for self-hosted systems.

This commit makes the 'Zulip' part a variable in the following
email sender names: 'Zulip Account Security', 'Zulip Digest',
and 'Zulip Notifications' by introducing a settings variable
'SERVICE_NAME' with the default value as f"{EXTERNAL_HOST} Zulip".

Fixes: #23857
This commit is contained in:
Prakhar Pratyush
2022-12-24 22:01:48 +05:30
committed by Tim Abbott
parent 44d8dc66d2
commit d8cf12eaaa
10 changed files with 25 additions and 10 deletions

View File

@@ -9,6 +9,7 @@ from django.conf import settings
from django.db import transaction
from django.db.models import Exists, OuterRef
from django.utils.timezone import now as timezone_now
from django.utils.translation import gettext as _
from typing_extensions import TypeAlias
from confirmation.models import one_click_unsubscribe_link
@@ -408,7 +409,7 @@ def bulk_handle_digest_email(user_ids: List[int], cutoff: float) -> None:
"zerver/emails/digest",
user.realm,
to_user_ids=[user.id],
from_name="Zulip Digest",
from_name=_("{service_name} digest").format(service_name=settings.INSTALLATION_NAME),
from_address=FromAddress.no_reply_placeholder,
context=context,
)