fix(send_mail): Save after each sent mail, as the bottleneck is in the SMTP
This commit is contained in:
parent
8f88eef5c7
commit
fd65aa36ad
1 changed files with 2 additions and 3 deletions
|
@ -461,9 +461,8 @@ def send_mail(election: "Election", subject: str, body: str, reply_to: str) -> N
|
|||
for m, v in messages:
|
||||
try:
|
||||
m.send()
|
||||
v.has_valid_email = True
|
||||
except smtplib.SMTPException:
|
||||
v.has_valid_email = False
|
||||
else:
|
||||
v.has_valid_email = True
|
||||
|
||||
User.objects.bulk_update(voters, ["password", "has_valid_email"])
|
||||
v.save()
|
||||
|
|
Loading…
Reference in a new issue