How eghost1/automailsender works
Project Type and Purpose
• AutoMailSender is a command‑line Python tool (an open‑source utility) for automated bulk email sending via Gmail.
• It reads recipient lists (CSV or TXT), personalizes a template, sends mail through Gmail’s SMTP, and logs sent messages.
File Structure Analysis
• Top‐level script and config:
• mail_sender.py – main entry point & orchestrator
• config.py – holds Gmail credentials & settings
• Data files:
• email_template.txt – message template with placeholders
• recipients.csv / recipients.txt – input lists
• sent_emails.txt (runtime) – log of sent mails
• Support:
• requirements.txt – dependencies (pandas, smtplib, email)
• .gitignore – ignores config, logs, etc.
Core Components
a. Config Loader
• Reads config.py for EMAIL_ORIGIN, EMAIL_PASSWORD
• Supplies credentials to the SMTP client
b. Recipient Parser
• Branch A: CSV parser (pandas)
• Branch B: TXT parser (regex or line parsing)
c. Template Engine
• Reads email_template.txt
• Substitutes [NOMBRE] with recipient data
d. Mail Sender (SMTP Client)
• Uses smtplib & email libraries
• Connects to Gmail SMTP (smtp.gmail.com)
• Authentication via app password
e. Logger
• Appends timestamp, recipient name & email to sent_emails.txt
Component Interactions & Data Flow
• At startup, Config Loader → initializes SMTP client
• User selects input file → Recipient Parser reads list → emits list of {name, email}
• For each recipient:
• Template Engine + recipient data → generates personalized email
• Mail Sender → submits email to Gmail SMTP → success/failure response
• Logger → writes entry to sent_emails.txt
Architectural Patterns & Principles
• Separation of Concerns: parsing, templating, sending, logging each in its own module/function
• Single Responsibility: each component does one job
• Extensibility Point: easily swap parsers or add new mail providers by conforming to a common interface
Technologies & External Services
• Python 3.6+
• pandas (CSV parsing)
• smtplib & email (SMTP client)
• Gmail SMTP service (external)
• Local file system for templates, recipient lists, logs