emails: Added placeholders strings in FormAddress.

We've had a bug for a while that if any ScheduledEmail objects get
created with the wrong email sender address, even after the sysadmin
corrects the problem, they'll still get errors because of the objects
stored with the wrong format.

We solve this by using FromAddress placeholders strings in
send_future_email function, so that ScheduledEmail objects end up
setting the final `from_address` value when mail is actually sent
using the setting in effect at that time.

Fixes #11008.
This commit is contained in:
arpit551
2020-03-13 00:58:05 +05:30
committed by Tim Abbott
parent 96eb1bcd9d
commit 8f7733cb20
5 changed files with 17 additions and 5 deletions

View File

@@ -546,7 +546,7 @@ def enqueue_welcome_emails(user: UserProfile, realm_creation: bool=False) -> Non
from_address = settings.WELCOME_EMAIL_SENDER['email']
else:
from_name = None
from_address = FromAddress.SUPPORT
from_address = FromAddress.support_placeholder
other_account_count = UserProfile.objects.filter(
delivery_email__iexact=user.delivery_email).exclude(id=user.id).count()