Skip to content

grahammc-bit/EmailBlast

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Blast

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.

Features

  • 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

Prerequisites

  • Python 3.7+
  • SMTP server access (e.g., Gmail)
  • If using Gmail, you'll need an App Password

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/email-blast.git
cd email-blast
  1. Create a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate  # On Linux/Mac

Configuration

  1. Create a CSV file named recipients.csv with your recipient information:
email,name,company
john@example.com,John Doe,ACME Inc
jane@example.com,Jane Smith,XYZ Corp
  1. Create an HTML template file named email_template.html:
<html>
<body>
    <p>Hi {name},</p>
    <p>Your company {company} is awesome!</p>
</body>
</html>
  1. 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 password

Usage

Run the script:

python email_blast.py

The script will:

  1. Read recipients from your CSV file
  2. Load the HTML template
  3. Send personalized emails to each recipient
  4. Log all activities to a timestamped log file

Log Files

Log files are created in the project directory with the naming format:

email_blast_YYYYMMDD_HHMMSS.log

Security Notes

  • Never commit sensitive information like passwords to version control
  • Use environment variables or a .env file for credentials
  • Consider using a dedicated email service provider for large campaigns
  • Follow email sending best practices and anti-spam regulations

Project Structure

email-blast/
│
├── email_blast.py      # Main script
├── email_template.html # Email template
├── recipients.csv      # Recipient list
├── .gitignore         # Git ignore file
└── README.md          # This file

Error Handling

The script includes comprehensive error handling for:

  • CSV file reading errors
  • Template file reading errors
  • SMTP connection issues
  • Individual email sending failures

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published