send_email: Add support for multiple recipients.

This adds a function that sends provided email to all administrators
of a realm, but in a single email. As a result, send_email now takes
arguments to_user_ids and to_emails instead of to_user_id and
to_email.

We adjust other APIs to match, but note that send_future_email does
not yet support the multiple recipients model for good reasons.

Tweaked by tabbott to modify `manage.py deliver_email` to handle
backwards-compatibily for any ScheduledEmail objects already in the
database.

Fixes #10896.
This commit is contained in:
Raymond Akornor
2018-12-03 22:26:51 +00:00
committed by Tim Abbott
parent 0fddf9a610
commit 92dc3637df
16 changed files with 76 additions and 49 deletions

View File

@@ -232,7 +232,7 @@ class ConfirmationEmailWorker(QueueProcessingWorker):
send_future_email(
"zerver/emails/invitation_reminder",
referrer.realm,
to_email=invitee.email,
to_emails=[invitee.email],
from_address=FromAddress.tokenized_no_reply_address(),
context=context,
delay=datetime.timedelta(days=2))