Fix missing email context values and pass site configuration to better multi-site customization


We've found that some of the email being sent from the platform doesn't have ``platform_name`` and ``contact_mailing_address`` in their context, resulting in empty values in the email body. This PR adds those.
Also, when using multiple sites, there are not enough customization options, ex - having a different logo for each site in email templates. This PR adds``SiteConfiguration.site_values`` in the email template context, to add support for such customizations.

~*JIRA tickets*:~

*Dependencies*: None

~*Sandbox URL*:~

*Merge deadline*: None

*Testing instructions*:

1. Pull this PR in local devstack.
2. Log in to LMS and go to the instructor dashboard of a course.
3. Enroll a student using an email address and send an enrollment email.
4. Check the ``src/ace_messages`` directory for rendered email and verify Platform name and mailing address is rendered properly.
5. Log in to the LMS Django admin
6. Add any new configuration in the default site's site configurations. For example -
```"external_logo": ""```
7. Override ``ace_common/edx_ace/common/base_body.html`` in a custom theme or modify directly and set [logo src|( to ``{{ site_configuration_values.external_logo }}``.
8. Send an email from the platform and check that the logo URL from the site configuration is rendered. In this way, we can customize any value for different sites.

*Author notes and concerns*:

1. We did not find any other way to support email customizations for a multisite setting other than passing the site configuration to the email context. It will save us from code drift, like adding each customizable configuration on the function that prepares email context.
2. We think it would be nicer if there were a single point where the base context for all kind of email templates are prepared. Right now, there are three different places where these contexts are produced.


  • [ ] @lgp171188

  • [ ] edX reviewer[s] TBD


Sarina Canelake
March 16, 2021, 4:23 PM

Cool. I’ll inform Open Craft that they should do core committer review moving forward for PRs like this. Thanks for taking a look!

George Babey
March 16, 2021, 4:09 PM

Hi - Enterprise hasn’t supported multi-site configurations on in almost 2 years now, since we stopped the white label business. Given that, theres little-to-no expertise here as well - the only person from the team formerly known as “white-label” is on the Programs theme.

Personally I think we need to leave it up the community to continue to support multi-site if they find it valuable, but knowing that we’re not using or testing for multi-site config here we may inadvertently break something for them that doesn’t show up in our own non- multisite testing.

All that said - I agree the PR looks fine overall.

Sarina Canelake
March 16, 2021, 3:06 PM

Ping – is this something your team can take a look at? I checked with the T&L team and we don’t feel we have full expertise on email context values/site configurations.


Sarina Canelake
March 4, 2021, 7:25 PM

I’ve taken a pass at this and semantically it looks good to me (requested some basic changes), but I don’t know a ton about site configurations. I wonder if the ENT team should take a look at this - pinging



Sarina Canelake


Open Source Pull Request Bot


Contributor Name

Shimul Chowdhury




Epic Link


OSCM Assignee


Platform Map Area (Levels 1 & 2)


Platform Map Area (Levels 3 & 4)


Blended Hour Utilization Percentage


edX Theme


edX Squad


Github Lines Added


Github Lines Deleted