Last active
October 3, 2020 09:22
-
-
Save Tobi-De/27fb76fe9f103b8e9318f1e8e63ccbc9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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