From ec89f232b37a3bef573ffccbc904a5e926e77221 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9lestin=20Matte?= <dev@cmatte.me>
Date: Sat, 16 Aug 2025 16:59:17 +0200
Subject: [PATCH] Bugfix: crashes for should-not-happen case

---
 lib/handlers/bouncehandler.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/handlers/bouncehandler.py b/lib/handlers/bouncehandler.py
index 9b282d2..ced571c 100644
--- a/lib/handlers/bouncehandler.py
+++ b/lib/handlers/bouncehandler.py
@@ -7,6 +7,7 @@ from mailutil.header import decode_mime_header
 from mailutil.body import get_truncated_body
 from baselib.misc import log
 from baselib.config import config
+from baselib.template import send_mailtemplate
 
 archives_bounce_re = re.compile(r'^(.*)-owner\+archive@(.*)$', re.I)
 regular_bounce_re = re.compile(r'^(.*)-owner\+M(\d+)-(\d+)@(.*)$', re.I)
@@ -227,7 +228,7 @@ class BounceHandler(object):
         # This is a Should Never Happen (TM) thing, so just fire off an email to the list owner as quickly
         # as possible.
         send_mailtemplate(
-            curs,
+            self.curs,
             config.get('bounces', 'senderaddr'),
             config.get('bounces', 'sendername'),
             config.get('notify', 'address'),
-- 
2.50.1

