This repository contains a Python automation script that extracts email addresses from a PDF file (containing HR contacts), and sends job/internship applications with an attached resume to those addresses.
The script is designed to:
- 📂 Extract emails directly from a PDF.
- 📎 Attach your resume automatically.
- ✉️ Send personalized emails with a professional message.
- ⏳ Send emails in daily batches (default: 100/day) to avoid being flagged as spam.
- 📝 Keep track of already-sent emails in
sent_emails.txt
, so you never resend duplicates.
- Extracts all HR emails from a PDF using PyPDF2 and Regex.
- Sends emails via Gmail SMTP (works with other providers too).
- Uses raw MIME format to minimize spam issues.
- Supports resume attachment (PDF format).
- Safe sending with batch limits and progress tracking.
Make sure you have Python 3.7+ installed.
Install dependencies:
pip install PyPDF2
smtplib
,base64
,re
, andos
are built-in with Python — no need to install them.
Edit the script to update the following values:
# Email Settings
EMAIL = "[email protected]" # Sender email
PASSWORD = "your_app_password" # App password (not your Gmail password!)
SMTP_SERVER = "smtp.gmail.com"
SMTP_PORT = 587
# Resume & Files
RESUME_PATH = "your_resume.pdf" # Resume file path
EMAILS_FILE = "hr_emails_file.pdf" # PDF file with HR contacts
SENT_LOG = "sent_emails.txt" # Keeps track of already contacted emails
# Sending Settings
SUBJECT = "Your Email Subject"
DAILY_LIMIT = 30 # Number of emails per day (safe for Gmail)
If you’re using Gmail with 2FA enabled:
- Enable 2-Step Verification in your Google Account.
- Generate an App Password:
- Go to Google App Passwords.
- Choose "Other" and name it (e.g.,
PythonEmailBot
). - Copy the 16-character password and paste it into the script as
PASSWORD
.
-
Place your resume (
your_resume.pdf
) and HR contacts PDF (hr_emails_file.pdf
) in the same folder as the script. -
Run the script:
python send_emails.py
-
The script will:
- Extract emails from
hr_emails_file.pdf
. - Skip emails already present in
sent_emails.txt
. - Send emails in a daily batch of 100 (or your chosen limit).
- Save successfully sent emails to
sent_emails.txt
.
- Extract emails from
-
Re-run the script daily until all emails are sent.
📦 email-automation
┣ 📜 send_emails.py # Main automation script
┣ 📜 your_resume.pdf # Your resume (attachment)
┣ 📜 hr_emails_file.pdf # HR contacts PDF
┣ 📜 sent_emails.txt # Log of already contacted HR emails
┗ 📜 README.md # Project documentation
- Gmail free accounts allow ~100–150 emails/day safely. Exceeding this may result in temporary suspension.
- Always personalize messages when possible — generic mass emails are more likely to land in spam.
- Respect email privacy and avoid spamming.
Subject: Application for IT jobs or Internship opportunities
Body:
Dear Hiring Manager,
I hope this message finds you well.
I am reaching out to express my interest in IT job or internship opportunities at your organization.
I have recently graduated in Bachelor of Technology in Computer Science and Engineering (CGPA: 8.35)
from Chaibasa Engineering College, Jharkhand, and have developed a strong foundation in
computer science concepts, software development, and real-world applications.
[...skills & experience here...]
Please find my resume attached for your review.
I would be grateful for the opportunity to discuss how my background, skills,
and enthusiasm align with potential opportunities at your organization.
Best regards,
Piyush Pratap
Feel free to fork this repo and adapt the script for your own use cases.
Pull requests are welcome if you’d like to improve it (e.g., adding HTML email support or logging features).
This project is for personal use only.
Please use responsibly and comply with email privacy laws (e.g., avoid sending unsolicited bulk spam).