send_email: Use STATIC_URL as base for images in emails.

This commit is contained in:
Alex Vandiver
2023-02-02 23:41:49 +00:00
committed by Alex Vandiver
parent e31767dda4
commit 72ac38eff8

View File

@@ -113,10 +113,14 @@ def build_email(
# except having just a domain instead of an email address. # except having just a domain instead of an email address.
extra_headers["List-Id"] = formataddr((realm.name, realm.host)) extra_headers["List-Id"] = formataddr((realm.name, realm.host))
assert settings.STATIC_URL is not None
context = { context = {
**context, **context,
"support_email": FromAddress.SUPPORT, "support_email": FromAddress.SUPPORT,
"email_images_base_uri": settings.ROOT_DOMAIN_URI + "/static/images/emails", # Emails use unhashed image URLs so that those continue to
# work over time, even if the prod-static directory is cleaned
# out; as such, they just use a STATIC_URL prefix.
"email_images_base_uri": settings.STATIC_URL + "images/emails",
"physical_address": settings.PHYSICAL_ADDRESS, "physical_address": settings.PHYSICAL_ADDRESS,
} }