first commit

This commit is contained in:
bolade
2025-08-05 22:29:54 +01:00
commit 974ffa6554
33 changed files with 3297 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
#!/usr/bin/env python3
"""
Email Alerts System - Main Entry Point
"""
from email_processor import EmailProcessor
from dotenv import load_dotenv
import sys
def main():
"""Main function to run the email alerts system"""
print("🚀 Email Alerts System")
print("=" * 40)
# Load environment variables
load_dotenv()
try:
# Initialize processor
processor = EmailProcessor()
# Process emails with alerts enabled - no limit
result = processor.process_emails(max_results=None, send_alerts=True)
if result.get('status') == 'success':
print("✅ Processing complete!")
print(f"📧 Total emails: {result.get('total_emails', 0)}")
print(f"🔍 Actionable emails: {result.get('actionable_emails', 0)}")
print(f"📱 Alerts sent: {len(result.get('sent_alerts', []))}")
# Show alert details
sent_alerts = result.get('sent_alerts', [])
if sent_alerts:
print(f"\n📱 Sent {len(sent_alerts)} WhatsApp alerts:")
for i, alert in enumerate(sent_alerts, 1):
status = "✅ Success" if alert.get('status') == 'success' else "❌ Failed"
print(f" {i}. {status} - Thread: {alert.get('thread_id', 'N/A')}")
if alert.get('message_sid'):
print(f" Message SID: {alert['message_sid']}")
else:
print(f"❌ Processing failed: {result.get('error', 'Unknown error')}")
sys.exit(1)
except Exception as e:
print(f"❌ System error: {e}")
sys.exit(1)
if __name__ == "__main__":
main()