├── .gitignore ├── recruiter_emails.py ├── parse_mails.py ├── README.md └── coldmail.py /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /recruiter_emails.py: -------------------------------------------------------------------------------- 1 | # the most useless 2 lines of code you'll ever read 2 | from parse_mails import data 3 | recruiter_emails = data -------------------------------------------------------------------------------- /parse_mails.py: -------------------------------------------------------------------------------- 1 | # parsing script was developed jul 26, 2020 by Alex Jabbour 2 | import openpyxl 3 | from pathlib import Path 4 | 5 | xlsx_file = Path('.', 'Recruiter-emails.xlsx') 6 | wb_obj = openpyxl.load_workbook(xlsx_file) 7 | 8 | # Read the active sheet: 9 | sheet = wb_obj.active 10 | 11 | data = [] 12 | 13 | for i, row in enumerate(sheet.iter_rows(values_only=True)): 14 | name = None 15 | if row[0] != None and row[1] != None: 16 | if row[2] != None: name = row[2][:row[2].find('[')] 17 | data.append({"company":row[0], "email":row[1], "name":name}) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Coldmail-script 2 | 3 | A python script for sending cold emails to recruiters - automate everything with python 🧠 4 | 5 | This script is configured to send from a gmail account 📨 6 | 7 | `recruiter_emails.py` and `parse_mails.py` act as parsing agents to convert data from an excel sheet into a python dict - we loop through every column in the excel sheet and create an element in an array for them. 📖 8 | 9 | To use this script: 10 | 11 | 1. `git pull git@github.com:AlexJubs/Coldmail-script.git` 12 | 2. Create an excel file, call it `Recruiter-Emails.xlsx` 13 | 3. In `Recruiter-Emails.xlsx` fill out each row with the 3 elements: | | - optional 14 | 4. Set environment variables by executing into your shell: `export gmail_email=` and `export gmail_password=` (unset these as SOON as you're done with this script) 15 | 5. Go to your gmail account settings, click "Manage Google Account", then go to "Security" and turn on "Less secure app access" (and turn this off as SOON as you're done with this script) 16 | 6. Make sure you have python3 installed and type `python3 coldmail.py` and watch your gmail "sent" page for the emails you just sent 17 | 18 | PS: Unless you're me from summer 2020, please change the email message text 😉 19 | 20 | Enjoy! please reach out to me if you have any suggestions at www.linkedin.com/in/alexjabbour 21 | -------------------------------------------------------------------------------- /coldmail.py: -------------------------------------------------------------------------------- 1 | # this script was created by Alex Jabbour on Nov 15, 2019 2 | import smtplib 3 | import os 4 | from recruiter_emails import recruiter_emails 5 | 6 | # recruiter_emails is a list of objects with structure {"name":, "email":, "company":} 7 | 8 | class coldmail: 9 | def __init__(self, recruiter_name, company_name, email_address): 10 | 11 | if (recruiter_name == None): recruiter_name = company_name + " hiring manager(s)" 12 | # compose email string 13 | message = """ 14 | Greetings {}, my name is Alex Jabbour. 15 | 16 | I understand your time is valuable, I only have 3 things to say: 17 | 18 | I've been developing object-oriented code and writing systematic python scripts since I was 13. I read a lot and not afraid to learn new technologies. 19 | 20 | I have 1 year of experience working as a software engineer, managing cloud infrastructure, and developing microservices - 8 months of which in Silicon Valley. 21 | 22 | I want to intern for {}. Can I forward my resume? 23 | 24 | Warm regards, 25 | Alex 26 | """.format(recruiter_name, company_name) 27 | 28 | subject = "My interest in a SWE internship at {}".format(company_name) 29 | 30 | # establish connection to outlook email 31 | self.FROM = os.environ["gmail_email"] 32 | self.TO = [email_address] 33 | 34 | # Prepare message wrapper 35 | self.full_mail = """From: %s\r\nTo: %s\r\nSubject: %s\r\n\ 36 | 37 | %s 38 | """ % (self.FROM, ", ".join(self.TO), subject, message) 39 | 40 | self.send_mail() 41 | 42 | def send_mail(self): 43 | # Send the mail 44 | server.sendmail(self.FROM, self.TO, self.full_mail) 45 | 46 | if __name__ == "__main__": 47 | # run the script 48 | server = smtplib.SMTP("smtp.gmail.com:587") 49 | server.ehlo() 50 | server.starttls() 51 | server.login(os.environ["gmail_email"], os.environ["gmail_password"]) 52 | 53 | # go thru each recruiter, taking the name, company and email 54 | for recruiter in recruiter_emails: 55 | coldmail(recruiter["name"], recruiter["company"], recruiter["email"]) 56 | 57 | server.quit() 58 | 59 | 60 | --------------------------------------------------------------------------------