import logging from fastapi_mail import FastMail, MessageSchema, ConnectionConfig, MessageType from pydantic import EmailStr from app.config import get_settings settings = get_settings() conf = ConnectionConfig( MAIL_USERNAME=settings.mail_username, MAIL_PASSWORD=settings.mail_password, MAIL_FROM=settings.mail_from, MAIL_PORT=settings.mail_port, MAIL_SERVER=settings.mail_server, MAIL_STARTTLS=settings.mail_tls, MAIL_SSL_TLS=settings.mail_ssl, USE_CREDENTIALS=True, VALIDATE_CERTS=True ) async def send_interview_email(candidate_email: EmailStr, candidate_name: str, date: str, time: str, meeting_link: str, notes: str): # Only try to send if credentials are provided if not settings.mail_username or not settings.mail_password: logging.warning("Email credentials not configured. Skipping interview email sending.") return False html = f"""
Hi {candidate_name},
Your interview has been scheduled for {date} at {time}.
Meeting Link: {meeting_link}
{f'Notes: {notes}
' if notes else ''}Best regards,
HireAI Team