Skip to content

Ashish10-AI/mail-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

📬 Mail Bot — Automated Lead Scraper & Cold Email Sender

A Python automation tool that scrapes local business leads from JustDial and automatically sends personalized cold outreach emails via Gmail. Built for freelancers who want to scale their client prospecting without manual effort.


🚀 What It Does

This project is split into two scripts that work together as a pipeline:

  1. scraper.py — Scrapes business listings from JustDial for a given city and category, and saves them as a CSV file (leads.csv).
  2. bot.py — Reads the CSV, loops through each lead, and sends a personalized cold email to every valid email address found.

📁 Project Structure

mail-bot/
├── scraper.py      # Scrapes business leads from JustDial
├── bot.py          # Reads leads.csv and sends cold emails
└── leads.csv       # Auto-generated by scraper.py

🛠️ Tools & Libraries Used

Library / Tool Purpose
smtplib Sends emails via Gmail's SMTP server (built-in)
email.mime.text Constructs plain-text email messages (built-in)
pandas Reads and processes the CSV leads file
requests Makes HTTP requests to JustDial for scraping
BeautifulSoup (bs4) Parses HTML to extract business names from listings
os Checks if the leads file exists before running
Gmail SMTP + App Password Authenticates and sends emails from a Gmail account

⚙️ How to Run

Step 1 — Install Dependencies

pip install requests beautifulsoup4 pandas

Step 2 — Scrape Leads

Edit the last line of scraper.py to set your target city and category:

df = scrape_leads("Dehradun", "restaurants")

Then run:

python scraper.py

This generates leads.csv with business name, city, category, phone, email, and status.

Step 3 — Send Emails

Update your Gmail credentials in bot.py:

YOUR_EMAIL = "[email protected]"
APP_PASSWORD = "your_app_password"

⚠️ Use a Gmail App Password, not your regular password. Enable 2FA on your Google account first, then generate one at myaccount.google.com → Security → App Passwords.

Then run:

python bot.py

📊 leads.csv Format

Business Name City Category Phone Email Status
ABC Cafe Dehradun restaurants 9999999999 [email protected] Not Contacted

⚠️ Notes & Limitations

  • JustDial may block automated requests with a 403 error. The scraper uses a Chrome-like User-Agent header to reduce this risk.
  • Most JustDial listings don't expose emails publicly — the scraper currently uses a test/fallback email. For production use, integrate a dedicated email-finding API (e.g., Hunter.io).
  • Do not hardcode real credentials in the script. Use environment variables or a .env file for production.

💡 Use Case

Perfect for freelancers doing cold outreach to local businesses — restaurants, gyms, salons, agencies — to pitch web design, automation, or other services.


👤 Author

Ashish — Freelance Creative Technologist
GitHub: Ashish10-AI

About

A Python automation tool that scrapes local business leads from JustDial and sends personalized cold outreach emails via Gmail — built for freelancers to scale client prospecting without manual effort.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages