Skip to content

This Python script automates the process of sending bulk emails with attachments (certificates) using Mailjet's API. With Mailjet's free tier, you can send up to 200 emails per day (6,000 emails per month) instantly without any cost.

License

Notifications You must be signed in to change notification settings

lovnishverma/certificate-email-sender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Certificate Email Sender - Mailjet GUI v1.4

A professional desktop application for sending personalized certificate emails in bulk using the Mailjet API. Built with Python and Tkinter, featuring an intuitive GUI, real-time progress tracking, and comprehensive error handling.

πŸš€ Quick Start

For Windows Users (No Python Required):

  1. Download mailjet.exe from Releases
  2. Double-click to launch the application
  3. Follow the setup wizard in the GUI

For Python Users:

git clone https://github.com/lovnishverma/certificate-email-sender.git
cd certificate-email-sender
pip install -r requirements.txt
python mailjet.py

πŸ“‹ Table of Contents

✨ Features

Core Functionality

  • Bulk Email Sending: Send personalized certificates to multiple recipients
  • Multi-format Support: Compatible with Excel (.xlsx) and CSV (.csv) files
  • PDF Attachment: Automatically attach certificates based on certificate numbers
  • Email Validation: Built-in validation to prevent sending to invalid addresses

User Experience

  • Intuitive GUI: Clean, user-friendly interface built with Tkinter
  • Real-time Progress: Live progress bar and detailed logging
  • Summary Reports: Comprehensive email delivery summary sent to sender
  • Secure Configuration: Encrypted API key storage with masked input fields

Technical Features

  • Error Handling: Robust error detection and recovery
  • Configuration Persistence: Auto-saves settings in config.json
  • Cross-platform: Runs on Windows, macOS, and Linux
  • Standalone Executable: Windows .exe version requires no Python installation

πŸ“¦ Prerequisites

For Python Installation

  • Python 3.7 or higher
  • Active internet connection
  • Mailjet account with API credentials

For Windows Executable

  • Windows 10 or later
  • Active internet connection
  • Mailjet account with API credentials

Mailjet Account Setup

  1. Create a free account at Mailjet.com
  2. Navigate to Account Settings β†’ REST API β†’ API Key Management
  3. Generate your API Key and Secret Key
  4. Keep these credentials secure - you'll need them for the application

πŸ› οΈ Installation

Python Installation

Step 1: Clone the Repository

git clone https://github.com/yourusername/certificate-email-sender.git
cd certificate-email-sender

Step 2: Create Virtual Environment (Recommended)

# Create virtual environment
python -m venv certificate_sender_env

# Activate virtual environment
# Windows:
certificate_sender_env\Scripts\activate
# macOS/Linux:
source certificate_sender_env/bin/activate

Step 3: Install Dependencies

pip install -r requirements.txt

Step 4: Launch Application

python mailjet.py

Windows Executable

  1. Download the latest mailjet.exe from the Releases page
  2. Save to your preferred location (no installation required)
  3. Double-click mailjet.exe to launch
  4. Windows may show a security warning - click "More info" β†’ "Run anyway"

βš™οΈ Configuration

First-Time Setup

  1. Launch the application
  2. Enter your Mailjet API credentials:
    • API Key: Your Mailjet public key
    • API Secret: Your Mailjet private key (masked for security)
    • Sender Name: Display name for outgoing emails
    • Sender Email: Must be verified in your Mailjet account

Configuration File

Settings are automatically saved to config.json in the application directory:

{
  "api_key": "your_api_key",
  "api_secret": "your_api_secret",
  "sender_name": "Your Organization",
  "sender_email": "[email protected]"
}

Security Note: Keep config.json secure and never share it publicly.

πŸ“– Usage

Step-by-Step Process

1. Prepare Your Data

Create an Excel or CSV file with the following columns:

  • full_name: Recipient's complete name
  • email: Recipient's email address
  • cert_no: Unique certificate identifier

2. Organize Certificate Files

  • Place all PDF certificates in a single folder
  • Name each certificate file exactly as: {cert_no}.pdf
  • Example: If cert_no is "CERT101", the file should be named "CERT101.pdf"

3. Configure Email Content

  • Subject Line: Customize the email subject
  • Email Body: Write your personalized message
  • Use placeholders:
    • {full_name} - Replaced with recipient's name
    • {cert_no} - Replaced with certificate number

4. Start Sending

  1. Click "Browse" to select your data file
  2. Click "Browse" to select your certificates folder
  3. Verify all settings are correct
  4. Click "Start Sending Emails"
  5. Monitor progress in the log window

Example Email Template

Subject: Your Certificate - Congratulations {full_name}!

Dear {full_name},

Congratulations on your achievement! Please find your certificate ({cert_no}) attached to this email.

Best regards,
The Certification Team

πŸ“Š Data Format Requirements

Required Columns

Your data file must contain these exact column names:

Column Description Example
full_name Recipient's complete name "John Smith"
email Valid email address "[email protected]"
cert_no Unique certificate identifier "CERT001"

Sample Data File

CSV Format:

full_name,email,cert_no
John Smith,[email protected],CERT001
Jane Doe,[email protected],CERT002
Bob Johnson,[email protected],CERT003

Excel Format:

full_name email cert_no
John Smith [email protected] CERT001
Jane Doe [email protected] CERT002
Bob Johnson [email protected] CERT003

File Naming Convention

Certificate PDF files must be named exactly as the cert_no value:

  • CERT001.pdf
  • CERT002.pdf
  • CERT003.pdf

πŸ” Progress Tracking & Reporting

Real-time Monitoring

  • Progress Bar: Visual indication of completion percentage
  • Live Log: Detailed status updates for each email
  • Error Reporting: Immediate notification of any issues

Summary Email

Upon completion, a summary report is automatically sent to the sender's email containing:

  • Total records processed
  • Number of emails sent successfully
  • Number of failed deliveries
  • List of failed recipients (if any)
  • Processing time and timestamp

πŸ› οΈ Troubleshooting

Common Issues and Solutions

Issue Possible Cause Solution
"Invalid email format" Email doesn't match standard format Verify email addresses in your data file
"Certificate not found" PDF file missing or incorrectly named Ensure {cert_no}.pdf exists in certificates folder
"API authentication failed" Incorrect Mailjet credentials Verify API Key and Secret in Mailjet dashboard
"Daily limit exceeded" Mailjet sending limit reached Wait 24 hours or upgrade your Mailjet plan
"Application won't start" Missing dependencies or corrupted installation Reinstall Python dependencies or re-download executable
"Permission denied" Insufficient file access rights Run as administrator or check file permissions

Debug Mode

To enable detailed logging:

  1. Open command prompt/terminal
  2. Navigate to application directory
  3. Run: python mailjet.py --debug (Python version only)

Getting Help

If you encounter persistent issues:

  1. Check the Issues page
  2. Create a new issue with:
    • Your operating system
    • Application version
    • Error message (if any)
    • Steps to reproduce the problem

πŸ”§ Building from Source

Creating Windows Executable

Prerequisites

pip install pyinstaller

Build Command

pyinstaller --noconfirm --onefile --windowed --name="Certificate_Email_Sender" mailjet.py

Advanced Build Options

pyinstaller --noconfirm --onefile --windowed \
  --add-data="config.json;." \
  --icon="icon.ico" \
  --name="Certificate_Email_Sender" \
  mailjet.py

The executable will be created in the dist/ directory.

Project Structure

certificate_email_sender/
β”œβ”€β”€ mailjet.py              # Main application code
β”œβ”€β”€ config.json             # Configuration file (auto-generated)
β”œβ”€β”€ requirements.txt        # Python dependencies
β”œβ”€β”€ README.md              # This documentation
β”œβ”€β”€ LICENSE                # License file
β”œβ”€β”€ .gitignore            # Git ignore rules
β”œβ”€β”€ dist/                 # Built executables
β”‚   └── Certificate_Email_Sender.exe
β”œβ”€β”€ build/                # Build artifacts
└── mailjet.spec          # PyInstaller configuration

πŸ“¦ Dependencies

mailjet-rest==1.3.4
pandas>=1.3.0
tqdm>=4.62.0
openpyxl>=3.0.9

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Make your changes and test thoroughly
  4. Commit your changes: git commit -am 'Add some feature'
  5. Push to the branch: git push origin feature/your-feature-name
  6. Submit a Pull Request

Development Guidelines

  • Follow PEP 8 style guidelines
  • Add comments for complex logic
  • Test on multiple platforms when possible
  • Update documentation for new features

πŸ“„ License

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

πŸ™ Acknowledgements

Built With

Special Thanks

  • Mailjet team for providing reliable email API
  • Python community for excellent libraries
  • Beta testers for valuable feedback

πŸ“ž Support


About

This Python script automates the process of sending bulk emails with attachments (certificates) using Mailjet's API. With Mailjet's free tier, you can send up to 200 emails per day (6,000 emails per month) instantly without any cost.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published