Skip to content

Commit

Permalink
get magic link without sending email in DEBUG mode
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Nov 13, 2024
1 parent b823e5d commit ee4c843
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lacommunaute/notification/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit ee4c843

Please sign in to comment.