diff --git a/core/apps/accounts/tasks.py b/core/apps/accounts/tasks.py
index 1a4c7de..b52c32b 100644
--- a/core/apps/accounts/tasks.py
+++ b/core/apps/accounts/tasks.py
@@ -5,11 +5,79 @@ from django.conf import settings
@shared_task
-def send_confirmation_code_to_email(email, code):
- send_mail(
- "Avto Cargo uchun tasdiqlash kod.",
- f"Bu sizning tasdiqlash kodingiz: {code}",
- settings.EMAIL_HOST_USER,
- [email],
- fail_silently=False,
- )
+def send_confirmation_email(user_email, code):
+ from django.core.mail import EmailMultiAlternatives
+
+ subject = "Код подтверждения для WISDOM Cargo"
+ from_email = settings.EMAIL_HOST_USER
+ to = [user_email]
+
+ html_content = f"""
+
+
+
+
+
+
+
+
+
Код подтверждения для WISDOM Cargo
+
Уважаемый {user_email},
+
Для завершения процесса регистрации на платформе Avto Cargo, пожалуйста, используйте следующий код подтверждения:
+
{code}
+
Пожалуйста, используйте этот код в течение 5 минут для завершения регистрации.
+
Если код не работает или вам нужна дополнительная помощь, свяжитесь с нами по адресу
+ wisdomcargo1@gmail.com.
+
+
+
+
+ """
+
+ msg = EmailMultiAlternatives(subject, "", from_email, to)
+ msg.attach_alternative(html_content, "text/html")
+ msg.send()
\ No newline at end of file
diff --git a/core/apps/accounts/views.py b/core/apps/accounts/views.py
index 30a44bd..6be802c 100644
--- a/core/apps/accounts/views.py
+++ b/core/apps/accounts/views.py
@@ -8,7 +8,7 @@ from rest_framework_simplejwt.tokens import RefreshToken
from core.apps.accounts import serializers
from core.apps.accounts import models
from core.apps.accounts.cache import cache_user_credentials, cache_user_confirmation_code
-from core.apps.accounts.tasks import send_confirmation_code_to_email
+from core.apps.accounts.tasks import send_confirmation_email
class RegisterApiView(generics.GenericAPIView):
@@ -28,7 +28,7 @@ class RegisterApiView(generics.GenericAPIView):
cache_user_confirmation_code(
email=email, code=code, time=60*5
)
- send_confirmation_code_to_email.delay(email, code)
+ send_confirmation_email.delay(email, code)
return Response(
{'success': True, 'message': "code sent"},
status=200