From 0fbb19c5fd9560d0ec2488603b97ee6d1c96eff1 Mon Sep 17 00:00:00 2001 From: bleizi Date: Thu, 5 Sep 2024 19:48:54 +0200 Subject: [PATCH] limite mail sending to 10 per minute and purge fail mail log --- note.cron | 1 + note_kfet/settings/base.py | 1 + 2 files changed, 2 insertions(+) diff --git a/note.cron b/note.cron index a54ad031..dc1f6460 100644 --- a/note.cron +++ b/note.cron @@ -9,6 +9,7 @@ MAILTO=notekfet2020@lists.crans.org * * * * * root cd /var/www/note_kfet && env/bin/python manage.py send_mail -c 1 -v 0 * * * * * root cd /var/www/note_kfet && env/bin/python manage.py retry_deferred -c 1 -v 0 00 0 * * * root cd /var/www/note_kfet && env/bin/python manage.py purge_mail_log 7 -v 0 + 00 0 * * * root cd /var/www/note_kfet && env/bin/python manage.py purge_mail_log -r failure 30 -v 0 # Faire une sauvegarde de la base de données 00 2 * * * root cd /var/www/note_kfet && apps/scripts/shell/backup_db # Vérifier la cohérence de la base et mailer en cas de problème diff --git a/note_kfet/settings/base.py b/note_kfet/settings/base.py index eb0b013d..8378448d 100644 --- a/note_kfet/settings/base.py +++ b/note_kfet/settings/base.py @@ -225,6 +225,7 @@ MEDIA_URL = '/media/' # Use mailer in production to place emails in a queue before sending them to avoid spam EMAIL_BACKEND = 'mailer.backend.DbBackend' MAILER_EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' +MAILER_EMAIL_MAX_BATCH = 10 EMAIL_USE_SSL = os.getenv('EMAIL_USE_SSL', False) EMAIL_HOST = os.getenv('EMAIL_HOST', 'smtp.example.org') EMAIL_PORT = os.getenv('EMAIL_PORT', 25)