HomeBlogs
Logo
Hamburger

The Pain of Job Hunting, Solved with Python!

Revolutionizing Job Applications: How I Used Python to Automate Sending Emails to HR, Streamlining the Application Process, and Saving Time with Simple Code, Email Validation, and PDF Resume Attachments.

Python Mail sender



As someone currently on the hunt for a new job, I’ve found myself spending countless hours going through various job portals, filling out endless job applications, and submitting my CVs. The process is repetitive and often frustrating, especially when it comes to manually sending individual emails to HR departments of different companies. Honestly, after a while, the constant typing and waiting for responses started to drive me a bit mad.


But then, my inner developer kicked in, and I thought, “Why not automate this process?” So, I set my mind to building a Python script that would handle sending emails to HR on my behalf. Little did I know that what started as a 3–4 hour project would take me a whole day or two to perfect, thanks to Python libraries like Pandas, SMTP, and a whole lot of trial and error. But in the end, I came up with a solution that was both satisfying and efficient.


Emails Hr



The Breakthrough

Let me walk you through the program I created.

The idea was simple: instead of manually sending emails, I would only need to input HR email addresses into an Excel sheet, and with the press of a button (F5), my Python script would automatically send an email to all of them—complete with a subject, body, and my resume attached. Sounds like magic, right? Well, let me break down how I made it work.

  1. Setting Up the Email System
    The first task was to figure out how to send an email using Python. I needed to use the SMTP (Simple Mail Transfer Protocol) module for that. Along with this, I used Pandas to handle the email list from my Excel file. The most important part was ensuring that my Gmail credentials were safely stored using environment variables. Google’s app password feature made this possible by generating a unique password for my Python script to use—an important security measure.

  2. Validating Emails
    To make sure I wasn’t sending emails to invalid addresses, I added a simple validation step. The program checks whether each email in the Excel sheet matches the regular expression (regex) pattern for a valid email. If it doesn’t, the email is flagged as invalid, and I’m notified at the end. The valid emails continue through the process, ensuring everything is neat and clean.

  3. Crafting the Email
    Next, I focused on the body of the email. I didn’t want to spend time typing out the same message every time I applied for a job, so I used Python's multiline strings to craft a simple, reusable email template. I also added a personalized touch by including placeholders like “[Company Name]” that could be dynamically updated in the future (if I choose to take it to the next level).

  4. Attaching the Resume
    One of the trickier parts was attaching my resume PDF. This involved some more research, but after a bit of R&D, I was able to add the PDF attachment to the email using Python's built-in modules. Now, with every email sent, my resume was automatically included as an attachment—no more manually uploading or attaching files.

  5. The Magic Button (F5)
    The real beauty of this script is that all I need to do now is press F5 to execute the program, and voila! The emails are sent to the HR departments of all the companies I’ve applied to. It’s as simple as that—no more tedious, repetitive tasks. The program does all the hard work for me.

Why It’s a Pythonic Solution

The beauty of this solution lies in its simplicity and efficiency. It might not be the most complicated program out there, but it’s a perfect example of a programmer’s mindset: finding a task and automating it. Python’s versatility makes it the ideal language for such automation, and using libraries like Pandas and SMTP made the process seamless. I didn’t have to rely on external tools or complex software—just pure Python and my programming instincts.

My Takeaway

While this script may not win any awards for complexity, it was an achievement for me—one that solved a real-world problem with a bit of Python magic. Plus, the sense of accomplishment in building something myself, without relying on AI tools like ChatGPT, was satisfying.

If you’re a fellow job hunter and want to save time by automating your application process, feel free to take this script, modify it, and improve upon it. The more feedback and updates I get, the better I can make it for everyone.

You can find the code here . I encourage you to make changes, try new ideas, and explore how Python can make life a little easier.

Thank you for taking the time to read my blog! Best of luck with your job hunt, and remember—automation is your friend!

Happy coding! 😎👨‍💻

Published on: Tue Feb 18 2025

Explore my other blogs

Hire Me For Your Next Amazing Project

Let’s make somthing new, different and more meaningful or make thing more visual or conceptual? Just say hello!

--- +91-9812914813

--- himanshusharma2719@gmail.com

--- Yamuna Nagar, Haryana, India