Spaces:
Sleeping
Sleeping
Download notification_tool.py from Bhaskar2611/Deadline_Manager: direct link, hf CLI and curl.
- Browser
- Download file 775 Bytes
-
https://huggingface.co/spaces/Bhaskar2611/Deadline_Manager/resolve/main/notification_tool.py
- Command line
-
hf download hf://spaces/Bhaskar2611/Deadline_Manager/notification_tool.py
-
curl -L -o notification_tool.py https://huggingface.co/spaces/Bhaskar2611/Deadline_Manager/resolve/main/notification_tool.py
775 Bytes
| import os | |
| import smtplib | |
| from email.message import EmailMessage | |
| def send_email_reminder(email, task_name, deadline): | |
| if not os.getenv("EMAIL_USER") or not os.getenv("EMAIL_PASSWORD"): | |
| return "Email disabled: missing credentials" | |
| msg = EmailMessage() | |
| msg.set_content(f"⏰ Reminder: '{task_name}' is due on {deadline}") | |
| msg["Subject"] = f"Deadline Reminder: {task_name}" | |
| msg["From"] = os.getenv("EMAIL_USER") | |
| msg["To"] = email | |
| try: | |
| with smtplib.SMTP_SSL("smtp.gmail.com", 465) as server: | |
| server.login(os.getenv("EMAIL_USER"), os.getenv("EMAIL_PASSWORD")) | |
| server.send_message(msg) | |
| return "✅ Email reminder sent!" | |
| except Exception as e: | |
| return f"❌ Failed to send email: {str(e)}" |