import os from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail, Email, To, Content from dotenv import load_dotenv load_dotenv() SENDGRID_API_KEY = os.getenv("SENDGRID_API_KEY") def send_email(subject: str, html_body: str): sg = SendGridAPIClient(api_key=SENDGRID_API_KEY) from_email = Email("rohanmanuel2005@gmail.com") # Change as needed to_email = To("rohanmanuel2005@gmail.com") # Change as needed content = Content("text/html", html_body) mail = Mail(from_email, to_email, subject, content).get() response = sg.client.mail.send.post(request_body=mail) print("Email response:", response.status_code) return {"status": "success"}