A Python-based mass email sending tool with personalization support. This tool allows you to send HTML emails to multiple recipients using templates with custom variables.
- CSV-based recipient management
- HTML email template support with variable substitution
- Personalized emails for each recipient
- Comprehensive error logging
- SMTP support with TLS
- Exception handling for reliable operation
- Python 3.7+
- SMTP server access (e.g., Gmail)
- If using Gmail, you'll need an App Password
- Clone the repository:
git clone https://github.com/yourusername/email-blast.git
cd email-blast- Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Linux/Mac- Create a CSV file named
recipients.csvwith your recipient information:
email,name,company
john@example.com,John Doe,ACME Inc
jane@example.com,Jane Smith,XYZ Corp
- Create an HTML template file named
email_template.html:
<html>
<body>
<p>Hi {name},</p>
<p>Your company {company} is awesome!</p>
</body>
</html>- Update the configuration in
email_blast.py:
SMTP_SERVER = "smtp.gmail.com" # Your SMTP server
SMTP_PORT = 587 # Your SMTP port
USERNAME = "your@email.com" # Your email
PASSWORD = "your-app-password" # Your password/app passwordRun the script:
python email_blast.pyThe script will:
- Read recipients from your CSV file
- Load the HTML template
- Send personalized emails to each recipient
- Log all activities to a timestamped log file
Log files are created in the project directory with the naming format:
email_blast_YYYYMMDD_HHMMSS.log
- Never commit sensitive information like passwords to version control
- Use environment variables or a
.envfile for credentials - Consider using a dedicated email service provider for large campaigns
- Follow email sending best practices and anti-spam regulations
email-blast/
│
├── email_blast.py # Main script
├── email_template.html # Email template
├── recipients.csv # Recipient list
├── .gitignore # Git ignore file
└── README.md # This file
The script includes comprehensive error handling for:
- CSV file reading errors
- Template file reading errors
- SMTP connection issues
- Individual email sending failures
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.