"""Email helpers for the web panel."""

from __future__ import annotations

import logging

from django.conf import settings
from django.core.mail import send_mail

logger = logging.getLogger(__name__)


def send_contact_query_reply(*, to_email: str, subject: str, body: str) -> None:
    """
    Send a staff reply for a contact query.
    Raises on failure so callers can avoid marking REPLIED.
    """
    from_email = getattr(settings, 'DEFAULT_FROM_EMAIL', 'no-reply@truckme.com')
    send_mail(
        subject.strip(),
        body.strip(),
        from_email,
        [to_email.strip()],
        fail_silently=False,
    )
