MACD_Strategy / test_visitor_email.py
dixitramjendra's picture
Fix backendStatus null error - add missing HTML element
30e2a89
Raw History Blame Contribute Delete
1.95 kB
#!/usr/bin/env python3
"""
Test script to send visitor report email
Uses email configuration from user input
"""
import sys
import os
from pathlib import Path
# Add current directory to path
sys.path.insert(0, str(Path(__file__).parent))
from daily_visitor_report import DailyVisitorReport
# Override email configuration
os.environ['EMAIL_ADDRESS'] = 'biasbuster2026@gmail.com'
os.environ['VISITOR_REPORT_EMAIL'] = 'biasbuster2026@gmail.com'
# Note: You need to set EMAIL_PASSWORD
# Get app password from: https://myaccount.google.com/apppasswords
if __name__ == "__main__":
print("=" * 60)
print("📧 Visitor Report Email Test")
print("=" * 60)
print()
# Check if password is set
if not os.getenv('EMAIL_PASSWORD'):
print("⚠️ EMAIL_PASSWORD not set!")
print()
print("To send emails, you need a Gmail App Password:")
print("1. Go to: https://myaccount.google.com/apppasswords")
print("2. Create an app password for 'Mail'")
print("3. Set it in .env file:")
print(" EMAIL_PASSWORD=your-16-char-app-password")
print()
print("Or set it temporarily:")
print(" export EMAIL_PASSWORD='your-app-password'")
print(" python3 test_visitor_email.py")
print()
sys.exit(1)
# Create and send report
report = DailyVisitorReport()
print(f"📧 Sending visitor report to: {report.email_to}")
print(f"📤 From: {report.email_from}")
print()
success = report.send_report()
if success:
print()
print("=" * 60)
print("✅ SUCCESS! Email sent successfully!")
print("=" * 60)
print()
print("Check your inbox: biasbuster2026@gmail.com")
else:
print()
print("=" * 60)
print("❌ FAILED! Could not send email")
print("=" * 60)
print()
print("Check the error messages above")