diff --git a/app/api/v1/admin/settings.py b/app/api/v1/admin/settings.py index 8f4bf670..6e2e8411 100644 --- a/app/api/v1/admin/settings.py +++ b/app/api/v1/admin/settings.py @@ -659,7 +659,7 @@ def send_test_email( email_service = EmailService(db) # Send test email using platform configuration - success = email_service.send_raw( + email_log = email_service.send_raw( to_email=request.to_email, to_name=None, subject="Wizamart Platform - Test Email", @@ -684,7 +684,8 @@ def send_test_email( is_platform_email=True, ) - if success: + # Check if email was actually sent (send_raw returns EmailLog, not boolean) + if email_log.status == "sent": # Log action admin_audit_service.log_action( db=db, @@ -703,7 +704,7 @@ def send_test_email( else: return TestEmailResponse( success=False, - message="Failed to send test email. Check server logs for details.", + message=email_log.error_message or "Failed to send test email. Check server logs for details.", ) except Exception as e: