MassMailCSV is a Python tool that allows you to send mass emails using data from CSV files and customizable HTML templates. The tool is designed to help you send personalized emails to a large number of recipients without having to manually write each email.
An Web version of this project can be found here: https://github.com/Sithey/sharpmailer
- Send mass emails based on CSV files with dynamic placeholders.
- Use HTML templates stored in a
templates/folder. - Secure SMTP credentials with environment variables (
.envfile). - Select CSV files and templates dynamically during execution.
- Supports SSL connections for SMTP servers.
- Python 3.x
- SMTP account (e.g., IONOS, Gmail, etc.)
-
Clone the repository:
git clone https://github.com/Sithey/MassMailCSV.git cd MassMailCSV -
Create a virtual environment and activate it:
python -m venv .venv source .venv/bin/activate # On Windows use: .venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Create a
.envfile to store your SMTP credentials:touch .env
Add the following variables to your
.envfile:SMTP_SERVER=smtp.example.com SMTP_PORT=465 SMTP_EMAIL=your_email@example.com SMTP_PASSWORD=your_password USE_SSL=True
-
Place your CSV files in the
emails/directory. -
Place your HTML templates in the
templates/directory. -
Run the script:
python send_emails.py
-
You will be prompted to:
- Enter the email subject.
- Select a CSV file from the
emails/directory. - Select an HTML template from the
templates/directory.
-
The script will send personalized emails based on the selected CSV file and template.
We recommend using htmleditor.tools to easily create and customize your email templates. It's a free online tool that allows you to visually design HTML emails and export them for use in this project. Simply design your template, export the HTML, and save it in the templates/ directory of your project.
<html>
<body>
<h1>Hello {name},</h1>
<p>Thank you for signing up!</p>
</body>
</html>/MassMailCSV/
│
├── send_emails.py # Main Python script to send emails
├── requirements.txt # Dependencies file
├── .env # SMTP credentials (not included in repo)
├── README.md # Project documentation
│
├── /emails/ # Directory for CSV files
│ └── example.csv # Sample CSV file with recipient data
│
├── /templates/ # Directory for HTML email templates
│ └── template1.html # Sample HTML email template
This project is licensed under the MIT License.