From 02bc25bf431da5e66f6957915bcafecbebc6c38a Mon Sep 17 00:00:00 2001 From: vincent porte Date: Wed, 13 Nov 2024 14:47:30 +0100 Subject: [PATCH] =?UTF-8?q?get=20magic=20link=20without=20sending=20email?= =?UTF-8?q?=20in=20DEBUG=C2=A0mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lacommunaute/notification/emails.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lacommunaute/notification/emails.py b/lacommunaute/notification/emails.py index 4a5601fc2..ba21f835a 100644 --- a/lacommunaute/notification/emails.py +++ b/lacommunaute/notification/emails.py @@ -21,7 +21,11 @@ def send_email(to, params, template_id, kind, bcc=None): if bcc: payload["bcc"] = bcc - response = httpx.post(settings.SIB_SMTP_URL, headers=headers, json=payload) + if settings.DEBUG: + logger.warning(f"Email sent: {payload}") + response = httpx.Response(200, json={"message": "OK"}) + else: + response = httpx.post(settings.SIB_SMTP_URL, headers=headers, json=payload) EmailSentTrack.objects.create( status_code=response.status_code,