POTE/EMAIL_SETUP.md
ilia 07af492026 Add email setup guide for levkin.ca mail server
Configuration for test@levkin.ca:
- SMTP: mail.levkin.ca:587 (STARTTLS)
- Includes setup instructions
- Testing checklist
- Troubleshooting guide

Note: .env file created locally (not committed, in .gitignore)
2025-12-15 15:43:44 -05:00

3.4 KiB

Email Setup for levkin.ca

Your POTE system is configured to use test@levkin.ca for sending reports.

Configuration Done

The .env file has been created with these settings:

SMTP_HOST=mail.levkin.ca
SMTP_PORT=587
SMTP_USER=test@levkin.ca
SMTP_PASSWORD=YOUR_MAILBOX_PASSWORD_HERE
FROM_EMAIL=test@levkin.ca
REPORT_RECIPIENTS=test@levkin.ca

🔑 Next Steps

1. Add Your Password

Edit .env and replace YOUR_MAILBOX_PASSWORD_HERE with your actual mailbox password:

nano .env
# Find the line: SMTP_PASSWORD=YOUR_MAILBOX_PASSWORD_HERE
# Replace with: SMTP_PASSWORD=your_actual_password
# Save and exit (Ctrl+X, Y, Enter)

2. Test the Connection

source venv/bin/activate
python scripts/send_daily_report.py --to test@levkin.ca --test-smtp

If successful, you'll see:

SMTP connection test successful!
✓ Daily report sent successfully!

And you should receive a test email at test@levkin.ca!

3. Set Up Automation

Once email is working, set up automated reports:

./scripts/setup_cron.sh

This will:

  • Use test@levkin.ca for sending
  • Send reports to test@levkin.ca (or you can specify different recipients)
  • Schedule daily reports (default: 6 AM)
  • Schedule weekly reports (Sundays at 8 AM)

📧 Email Server Details (For Reference)

Based on your Thunderbird setup:

Outgoing SMTP (what POTE uses):

  • Host: mail.levkin.ca
  • Port: 587
  • Security: STARTTLS (TLS on port 587)
  • Authentication: Normal password
  • Username: test@levkin.ca

Incoming IMAP (for reading emails in Thunderbird):

  • Host: mail.levkin.ca
  • Port: 993
  • Security: SSL/TLS
  • Username: test@levkin.ca

POTE only uses SMTP (outgoing) to send reports.

🔒 Security Notes

  1. Never commit .env to git!

    • Already in .gitignore
    • Contains sensitive password
  2. Password Security:

    • The password in .env is the same one you use in Thunderbird
    • It's stored in plain text locally (secure file permissions recommended)
    • Consider using application-specific passwords if your mail server supports them
  3. File Permissions (On Proxmox):

    chmod 600 .env  # Only owner can read/write
    

🎯 Change Recipients

To send reports to different email addresses (not just test@levkin.ca):

Option 1: Edit .env

REPORT_RECIPIENTS=user1@example.com,user2@example.com,test@levkin.ca

Option 2: Override in cron/scripts

# Manual send to different recipient
python scripts/send_daily_report.py --to someone-else@example.com

# The FROM address will still be test@levkin.ca

Testing Checklist

  • Updated .env with your actual password
  • Run python scripts/send_daily_report.py --to test@levkin.ca --test-smtp
  • Checked inbox at test@levkin.ca (check spam folder!)
  • If successful, run ./scripts/setup_cron.sh to automate

🐛 Troubleshooting

Error: "SMTP connection failed"

Check:

  1. Password is correct in .env
  2. Port 587 is not blocked by firewall
  3. Mail server is accessible: telnet mail.levkin.ca 587

Email not received

  1. Check spam folder in test@levkin.ca
  2. Check Thunderbird or webmail for the message
  3. Check POTE logs: tail -f ~/logs/daily_run.log

"Authentication failed"

  • Double-check username is test@levkin.ca (not just test)
  • Verify password is correct
  • Ensure account is active in mailcow

You're all set! POTE will send reports from test@levkin.ca 📧