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.
This project is split into two scripts that work together as a pipeline:
scraper.py— Scrapes business listings from JustDial for a given city and category, and saves them as a CSV file (leads.csv).bot.py— Reads the CSV, loops through each lead, and sends a personalized cold email to every valid email address found.
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
| 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 |
pip install requests beautifulsoup4 pandasEdit the last line of scraper.py to set your target city and category:
df = scrape_leads("Dehradun", "restaurants")Then run:
python scraper.pyThis generates leads.csv with business name, city, category, phone, email, and status.
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| Business Name | City | Category | Phone | Status | |
|---|---|---|---|---|---|
| ABC Cafe | Dehradun | restaurants | 9999999999 | [email protected] | Not Contacted |
- JustDial may block automated requests with a
403error. 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
.envfile for production.
Perfect for freelancers doing cold outreach to local businesses — restaurants, gyms, salons, agencies — to pitch web design, automation, or other services.
Ashish — Freelance Creative Technologist
GitHub: Ashish10-AI