diff --git a/utils/__init__.py b/utils/__init__.py index 36941ce..12b998c 100644 --- a/utils/__init__.py +++ b/utils/__init__.py @@ -95,8 +95,8 @@ def send_email(recipient, code): import requests from django.conf import settings - if not settings.RESEND_API_KEY: - print("RESEND_API_KEY is not set in settings.") + if not getattr(settings, "RESEND_API_KEY", None): + logger.warning("RESEND_API_KEY is not set in settings.") return False url = "https://api.resend.com/emails" @@ -105,48 +105,97 @@ def send_email(recipient, code): "Content-Type": "application/json", } - subject = 'Verification Code' + site_domain = getattr(settings, "SITE_DOMAIN", "https://dovodi.newhorizonco.uk/") + subject = "Код подтверждения | Verification Code" + html_content = f""" -
- - - -
- - Imam Javad Online School Logo -
- - -

Verification Code

- - -

Hello,

-

Your verification code for Imam Javad Online School is:

- - -
- {code} -
- - -

This code will expire shortly. If - you did not request this code, please ignore this email.

- - -
-

- Imam Javad Online School
- имам джавад | امام جواد
- Learn more: imamjavad.nwhco.ir
- Contact us: support@yourwebsite.com -

-
+ + + + + + Код подтверждения | Verification Code + + + + + + +
+ + + + + + + + + + + + + + + + + +
 
+ Dovodi Logo +
+ +
+ + Безопасность / Security + +
+ + +

+ Код подтверждения +

+ + +

+ Используйте следующий одноразовый код для входа или подтверждения учетной записи в Dovodi: +

+ + +
+ + {code} + +
+ + +
+ + + + +
+ ⏱ Внимание: Срок действия кода истекает через 5 минут. Если вы не запрашивали этот код, просто проигнорируйте это письмо. +
+
+ +

+ Никому не передавайте этот код в целях безопасности вашего аккаунта. +

+
+

+ Dovodi +

+

+ dovodi.newhorizonco.uk +  •  + [EMAIL_ADDRESS] +

+

+ © 2026 Dovodi. Все права защищены. +

+
+
+ + """ payload = { @@ -161,7 +210,7 @@ def send_email(recipient, code): response.raise_for_status() return True except Exception as e: - print(f"Failed to send email via Resend: {str(e)}") + logger.error(f"Failed to send email via Resend: {str(e)}") return False