fix(email): fix UnicodeEncodeError in print output, format App Password without spaces, add UTF-8 sys.stdout reconfigure

This commit is contained in:
Shanmuga Krishnan S M
2026-08-07 12:00:33 +05:30
committed by Devesh S
parent 0e22ad7b66
commit 0a94f2fc65
3 changed files with 7 additions and 3 deletions

View File

@@ -18,7 +18,7 @@ Two core scripts were added to the repository under the [`scripts/`](file:///f:/
| Parameter | Value |
| :--- | :--- |
| **Sender Email** | `krishnaowoxd@gmail.com` |
| **App Password** | `qkwy lwtc snlr pree` |
| **App Password** | `qkwylwtcsnlrpree` (no spaces) |
| **Recipient Email** | `dorutoslayer@gmail.com` |
| **SMTP Host / Port** | `smtp.gmail.com:587` (TLS) |

View File

@@ -4,11 +4,15 @@ import os
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
# Ensure UTF-8 output for terminal/logging
if hasattr(sys.stdout, 'reconfigure'):
sys.stdout.reconfigure(encoding='utf-8')
# Load configuration from environment or fallback defaults
SMTP_SERVER = os.environ.get("SMTP_SERVER", "smtp.gmail.com")
SMTP_PORT = int(os.environ.get("SMTP_PORT", 587))
SENDER_EMAIL = os.environ.get("SENDER_EMAIL", "krishnaowoxd@gmail.com")
SENDER_PASSWORD = os.environ.get("SENDER_PASSWORD", "qkwy lwtc snlr pree")
SENDER_PASSWORD = os.environ.get("SENDER_PASSWORD", "qkwylwtcsnlrpree").replace(" ", "")
RECIPIENT_EMAIL = os.environ.get("RECIPIENT_EMAIL", "dorutoslayer@gmail.com")
if len(sys.argv) < 7: