Repository navigation
Expand file tree
/
Copy pathsend_batch.py
More file actions
66 lines (46 loc) · 2.58 KB
/
Copy pathsend_batch.py
File metadata and controls
66 lines (46 loc) · 2.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import pandas as pd
import time
import sys
import os
sys.path.append(r"e:\ColdEmailAI")
from email_writer import send_gmail_api
from app_config import cfg
from logger import get_logger
logger = get_logger(__name__)
csv_path = r"e:\ColdEmailAI\hr_contacts.csv"
if not os.path.exists(csv_path):
print(f"CSV not found at {csv_path}")
sys.exit(1)
df = pd.read_csv(csv_path)
df = df.dropna(subset=['Email', 'Name', 'Company'])
SUBJECT_TEMPLATE = "Application for Full Stack AI Engineer | MLH Hackfest Gen-OS Builder at {company}"
BODY_TEMPLATE = """Dear {first_name},
I am reaching out to explore upcoming Full Stack and AI Engineering opportunities within the {company} team. I have been closely following the work {company} has been doing, and the way your team approaches complex software challenges immediately caught my attention.
I am a CS student at UPES. Recently, I engineered MorphOS—a browser-based Generative OS using Next.js and Gemini 2.0 Vision at the MLH AI Hackfest—and optimized backend APIs to reduce query execution time by 40% as a Full Stack Developer at BuildXLayer. This experience exposed me to building highly scalable, AI-integrated applications—which is exactly what drew me to {company}'s mission.
I know you are busy and may not have an open role listed right now, but I would love to learn from your experience and explore if there's a way I can contribute.
Would you be open to a brief 10-minute call sometime next week? If the timing isn't right, I'd be grateful to be kept in mind for future cycles. I have attached my resume for your reference.
Warm regards,
Ojaswee Upadhyay
+91 79855 48606
LinkedIn: https://www.linkedin.com/in/ojaswee-upadhyay-79a041320/
Portfolio: https://ojaswee.vercel.app
GitHub: https://github.com/Ojas2095"""
# Sending the very first batch (3 emails) as a live test
batch = df.head(3)
print(f"Starting email campaign. Sending to first {len(batch)} contacts...")
for index, row in batch.iterrows():
name = str(row['Name']).strip()
first_name = name.split()[0]
email = str(row['Email']).strip()
company = str(row['Company']).strip()
subject = SUBJECT_TEMPLATE.format(company=company)
body = BODY_TEMPLATE.format(first_name=first_name, company=company)
print(f"\nTarget: {name} ({email}) at {company}")
print(f"Subject: {subject}")
try:
send_gmail_api(to=email, subject=subject, body=body)
print("-> Sent Successfully! (Resume attached)")
except Exception as e:
print(f"-> Failed to send: {e}")
time.sleep(3) # Small delay to respect API rate limits
print("\nBatch 1 completed!")