Thresholding bounced newsletters email.

This commit is contained in:
Samuel Clay 2024-06-03 09:25:21 -04:00
parent d9e51f89a3
commit 7f045ba535

View file

@ -24,7 +24,7 @@ def main():
delivered = stats["delivered"]["total"]
accepted = stats["delivered"]["total"]
bounced = stats["failed"]["permanent"]["total"] + stats["failed"]["temporary"]["total"]
if bounced / float(delivered) > 0.5:
if bounced / float(delivered) > 0.5 and bounced > 100:
requests.post(
"https://api.mailgun.net/v2/%s/messages" % settings.MAILGUN_SERVER_NAME,
auth=("api", settings.MAILGUN_ACCESS_KEY),