DEV Community

Alex Spinov
Alex Spinov

Posted on

How I Automated Finding Contact Emails from Any Website

Every sales team needs leads. Every lead starts with an email address. Here's how I automated finding contact emails from any website.

The Problem

You find a company that could be a customer. You visit their website. The "Contact Us" page has a form — no email visible. The About page lists team members but no addresses.

Manually digging through HTML source code for mailto: links, checking social profiles, or guessing email formats (firstname@company.com) is tedious and scales terribly.

The Automated Approach

I built a tool that crawls any website and extracts every email address it finds. Here's how it works:

  1. Start from the homepage — fetch HTML
  2. Extract emails from the page — regex pattern matching for email formats
  3. Follow internal links — Contact, About, Team, Careers pages
  4. Check common locations — footer, header, JavaScript bundles, meta tags
  5. Deduplicate and validate — remove duplicates, verify format

The regex pattern handles edge cases:

// Handles standard emails + obfuscated ones
const emailPattern = /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;

// Also checks for obfuscation like "user [at] domain [dot] com"
const obfuscated = text
  .replace(/\[at\]/gi, '@')
  .replace(/\[dot\]/gi, '.')
  .replace(/\s*AT\s*/gi, '@')
  .replace(/\s*DOT\s*/gi, '.');
Enter fullscreen mode Exit fullscreen mode

Output

For each website, you get a clean list:

{
  "url": "https://example-startup.com",
  "emails": [
    "hello@example-startup.com",
    "sarah@example-startup.com",
    "careers@example-startup.com"
  ],
  "sources": [
    {"email": "hello@example-startup.com", "foundOn": "/contact"},
    {"email": "sarah@example-startup.com", "foundOn": "/team"},
    {"email": "careers@example-startup.com", "foundOn": "/careers"}
  ]
}
Enter fullscreen mode Exit fullscreen mode

Use Cases

Sales prospecting: Feed a list of 100 target company URLs → get contact emails for each.

Competitor research: Extract emails from competitor websites to understand their team structure.

Partnership outreach: Find the right contact at potential partner organizations.

Journalist outreach: Build media lists by extracting editor emails from publication websites.

Ethics and Legality

Important notes:

  • Only extract emails from public web pages
  • Respect robots.txt — if a site says "don't crawl," don't crawl
  • Follow anti-spam laws (CAN-SPAM, GDPR) when sending emails
  • Never scrape private/authenticated pages

Try It

I published this as Email Extractor Pro on Apify Store. Free to use. Just enter URLs and get emails.

Part of my collection of 77 free data tools covering social media, SEO, e-commerce, and more.

Need a custom lead list? I'll extract contact data from any set of websites — $20 for up to 500 contacts, delivered in 24h.

Order via Payoneer ($20) | All services


What's your current process for finding prospect emails? I'm curious how teams handle this at scale.

Top comments (0)