from django.core.management.base import BaseCommand from monitor.services.email_service import EmailService class Command(BaseCommand): help = 'Send a test email to verify configuration' def add_arguments(self, parser): parser.add_argument( '--email', type=str, required=True, help='Email address to send test to' ) def handle(self, *args, **options): email = options['email'] email_service = EmailService() self.stdout.write(f'Sending test email to {email}...') success, message = email_service.send_test_email(email) if success: self.stdout.write(self.style.SUCCESS('Test email sent successfully!')) self.stdout.write('Check your inbox (and spam folder).') else: self.stdout.write(self.style.ERROR(f'Failed to send test email: {message}'))