Spaces:
Sleeping

Deep_Research / email_agent.py
rohan131's picture
Upload folder using huggingface_hub
95a30b3 verified
Raw History Blame Contribute Delete
715 Bytes
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"}