Skip to content

Instantly share code, notes, and snippets.

@Tobi-De
Last active October 3, 2020 09:22
Show Gist options
  • Save Tobi-De/27fb76fe9f103b8e9318f1e8e63ccbc9 to your computer and use it in GitHub Desktop.
Save Tobi-De/27fb76fe9f103b8e9318f1e8e63ccbc9 to your computer and use it in GitHub Desktop.
def async_mass_mailing(subject, message, from_mail, recipients_list, offset=0, limit=100):
if not recipients_list:
return
for email in recipients_list[offset:offset + limit]:
send_mail(subject, message, from_mail, [email])
async_task(
async_mass_mailing,
subject=subject,
message=message,
from_mail=from_mail,
recipients_list=recipients_list[100:],
offset=offset + limit,
limit=100
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment