2025-12-08 15:02:31 +03:00

60 lines
2.1 KiB
Python

<<<<<<< HEAD
# programmer/management/commands/test_email.py
from django.core.management.base import BaseCommand
from django.conf import settings
from programmer.utils.email_notifications import send_test_email
class Command(BaseCommand):
help = 'Test email configuration'
def handle(self, *args, **options):
self.stdout.write("Testing email configuration...")
# Проверяем настройки
self.stdout.write(f"EMAIL_HOST: {settings.EMAIL_HOST}")
self.stdout.write(f"EMAIL_PORT: {settings.EMAIL_PORT}")
self.stdout.write(f"EMAIL_HOST_USER: {settings.EMAIL_HOST_USER}")
self.stdout.write(f"ADMIN_EMAILS: {settings.ADMIN_EMAILS}")
# Тестируем отправку
success = send_test_email()
if success:
self.stdout.write(
self.style.SUCCESS('✅ Test email sent successfully!')
)
else:
self.stdout.write(
self.style.ERROR('❌ Failed to send test email. Check your email settings.')
=======
# programmer/management/commands/test_email.py
from django.core.management.base import BaseCommand
from django.conf import settings
from programmer.utils.email_notifications import send_test_email
class Command(BaseCommand):
help = 'Test email configuration'
def handle(self, *args, **options):
self.stdout.write("Testing email configuration...")
# Проверяем настройки
self.stdout.write(f"EMAIL_HOST: {settings.EMAIL_HOST}")
self.stdout.write(f"EMAIL_PORT: {settings.EMAIL_PORT}")
self.stdout.write(f"EMAIL_HOST_USER: {settings.EMAIL_HOST_USER}")
self.stdout.write(f"ADMIN_EMAILS: {settings.ADMIN_EMAILS}")
# Тестируем отправку
success = send_test_email()
if success:
self.stdout.write(
self.style.SUCCESS('✅ Test email sent successfully!')
)
else:
self.stdout.write(
self.style.ERROR('❌ Failed to send test email. Check your email settings.')
>>>>>>> master
)