A Python-based email automation tool for sending emails with attachments, CC lists, and logging functionality. This tool is modular and easy to configure for various use cases.
- Send emails to multiple recipients.
- Attach files to emails.
- Add CC recipients.
- Log email statuses (success, error, invalid email).
- Modular design for easy maintenance and extension.
Email Tool/
├── emailer.py # Main script to execute the emailer tool
├── modules/
│ ├── email_utils.py # Utility functions for email handling
│ ├── smtp_utils.py # Utility functions for SMTP server setup
├── receipient_list.txt # List of recipient email addresses
├── cc_list.txt # List of CC email addresses
├── subject.txt # Email subject
├── body.txt # Email body
├── log.csv # Log file for email statuses
- Python 3.6 or higher
- Required Python libraries:
smtplibemailosredatetimetime
-
Clone the repository:
git clone <repository-url> cd Email Tool
-
Configure the following files:
receipient_list.txt: Add recipient email addresses (one per line).cc_list.txt: Add CC email addresses (one per line).subject.txt: Add the email subject.body.txt: Add the email body content.
-
Update the
emailer.pyscript:- Set the
senderemail address andpasswordin the global variables section. - Add file paths for attachments in the
attachment_file_pathslist.
- Set the
-
Run the script:
python emailer.py
-
The script will:
- Validate the sender email address.
- Check for required files (recipients, CC list, subject, body, log).
- Send emails to all valid recipients.
- Log the status of each email in
log.csv.
The log.csv file records the status of each email with the following columns:\
Recipient: The recipient's email address.Status:success,error, orinvalid.DateTime: The timestamp of the email attempt.Error: The error message (if any).
The project is divided into modules for better maintainability:
email_utils.py: Contains functions for sending emails and validating email addresses.smtp_utils.py: Contains functions for setting up the SMTP server.
- If using Gmail, ensure you have enabled "App Passwords" for authentication. Refer to Google's App Passwords Guide.
- The script pauses for 5 seconds between sending emails to avoid rate-limiting issues.
This project is licensed under the MIT License. See the LICENSE file for details.