This project sends emails (with your resume attached) to addresses from an Excel file and writes results to a CSV log.
Install these first:
- Python 3.10+
- A Gmail account (or another SMTP account)
- An SMTP app password (for Gmail, use App Passwords with 2FA enabled)
Make sure these files are in the project root (c:\Users\Gagana\Documents\Email Sending):
send_emails.pyrequirements.txt.envcleaned_company_emails.xlsxGagana Resume.pdf
Open PowerShell in this folder and run:
python -m venv .venv
.\.venv\Scripts\Activate.ps1If PowerShell blocks activation, run once:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassThen activate again:
.\.venv\Scripts\Activate.ps1pip install -r requirements.txtYour script reads SMTP settings from .env.
Use this format:
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_app_password
FROM_NAME=Your NameImportant:
SMTP_USERis your sender email.SMTP_PASSmust be an app password (not your normal Gmail password).- Keep
.envprivate and never share it.
The script expects:
- File name:
cleaned_company_emails.xlsx - Sheet name:
Unique_by_email - A column named exactly:
Email
If sheet name or column name is different, the script will stop with an error.
In send_emails.py, you can edit:
SUBJECTBODY_TEMPLATEATTACHMENT_FILE(currentlyGagana Resume.pdf)
In send_emails.py, review these values:
DRY_RUN = True
SLEEP_SECONDS = 2
MAX_EMAILS = 3
TEST_OVERRIDE_TO = "your_test_email@gmail.com"Recommended test setup:
DRY_RUN = True(no real emails sent)MAX_EMAILS = 3(small test batch)TEST_OVERRIDE_TO = "your_test_email@gmail.com"(all test sends go to you)
After successful testing, switch to real send:
DRY_RUN = False
MAX_EMAILS = None
TEST_OVERRIDE_TO = Nonepython .\send_emails.pyThe script writes logs to:
send_log.csv
Log columns:
timestampemailoriginal_emailstatus(SENT,FAILED, orDRY_RUN)error
-
Missing SMTP_USER / SMTP_PASS
Fix.envvalues and rerun. -
Excel not found
Confirmcleaned_company_emails.xlsxexists in the same folder. -
Excel sheet must contain a column named 'Email'
Rename/add the exactEmailcolumn in theUnique_by_emailsheet. -
Gmail auth errors (
535, login failed)
Recreate app password and verifySMTP_USER/SMTP_PASS. -
Attachment not found
EnsureGagana Resume.pdfexists in the project root.
- Activate virtual environment.
- Install requirements.
- Set
.env. - Confirm Excel sheet/column names.
- Run a
DRY_RUNtest withMAX_EMAILS = 3. - Run a real test using
TEST_OVERRIDE_TO. - Send to full list with
DRY_RUN = False,TEST_OVERRIDE_TO = None. - Review
send_log.csvfor failures and resend only failed emails if needed.