This Python project automatically generates personalized certificates from a template and emails them to participants listed in an Excel file.
- Reads participant data from an Excel file
- Generates personalized PDF certificates
- Emails certificates to participants
- Configurable certificate text position and styling
- Secure email sending using SMTP
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up your environment variables:
- Copy
.env.example
to.env
:cp .env.example .env
- Edit
.env
with your email credentials:- For Gmail:
- Enable 2-Step Verification in your Google Account
- Generate an App Password:
- Go to Google Account settings
- Security
- App Passwords (under 2-Step Verification)
- Select "Mail" and your device
- Use the generated 16-character password
- Update the .env file with your email and App Password
- For Gmail:
- Copy
-
Prepare your files:
- Place your certificate template PDF in the
templates
folder asCertificates.pdf
- Create an Excel file in the
data
folder namedparticipants.xlsx
with columns:name
: Participant's full nameemail
: Participant's email address
- Place your certificate template PDF in the
- Never commit your
.env
file to version control - The
.env
file is listed in.gitignore
to prevent accidental commits - Use
.env.example
as a template for required environment variables - Always use App Passwords for Gmail, never your account password
- Keep your credentials secure and never share them
.
├── README.md
├── requirements.txt
├── config.py
├── certificate_generator.py
├── .env.example
├── .gitignore
├── templates/
│ └── Certificates.pdf
├── data/
│ └── participants.xlsx
└── generated_certificates/
└── (generated certificates)
- Update
participants.xlsx
with participant information - Run the script:
python3 certificate_generator.py
You can customize:
- Certificate template
- Text position and styling
- Email subject and body
- File paths and naming conventions
All settings can be adjusted in the config.py
file.
The script includes error handling for:
- Missing files
- Invalid Excel format
- Certificate generation issues
- Email sending failures
Each error will be logged to the console while allowing the script to continue processing other participants.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
- Never commit sensitive information
- Always use environment variables for credentials
- Keep your App Passwords secure
- Regularly rotate your credentials
- Monitor your application's access and usage