Skip to content

jaydeexsf/Email-Hunter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

University Email Verifier

A Node.js backend system that automatically generates university email combinations, sends verification emails via Nodemailer, and stores valid addresses in MongoDB. Designed for large-scale email verification with multiple SMTP accounts and rate limiting.

Features

  • 🔄 Automated Email Generation: Creates university email combinations based on student numbers, names, and patterns
  • 📧 Multi-Account SMTP: Supports multiple email accounts for sending verification emails
  • Rate Limiting: Built-in rate limiting to respect email service limits
  • 🗄️ MongoDB Storage: Stores email addresses and verification status
  • 📊 Statistics & Monitoring: Track verification progress and system health
  • 🕐 Automated Scheduling: Cron jobs for continuous operation
  • 🛡️ Security: Rate limiting, CORS, and security headers

Quick Start

1. Install Dependencies

npm install

2. Environment Configuration

Copy env.example to .env and configure your settings:

cp env.example .env

Edit .env with your configuration:

# MongoDB
MONGODB_URI=mongodb://localhost:27017/email_verifier

# SMTP Accounts (Add multiple accounts)
SMTP_HOST_1=smtp.gmail.com
SMTP_PORT_1=587
SMTP_USER_1=your-email1@gmail.com
SMTP_PASS_1=your-app-password1

SMTP_HOST_2=smtp.gmail.com
SMTP_PORT_2=587
SMTP_USER_2=your-email2@gmail.com
SMTP_PASS_2=your-app-password2

# Add more accounts as needed...

# Rate Limiting
MAX_EMAILS_PER_HOUR=2
MAX_EMAILS_PER_DAY=50

# University Domain
UNIVERSITY_DOMAIN=myturf.ul.ac.za

3. Start the Server

npm start

API Endpoints

System Information

  • GET / - API documentation
  • GET /health - Health check

Email Management

  • GET /api/stats - Get system statistics
  • GET /api/verified - Get verified emails
  • POST /api/generate - Generate email combinations

Verification Control

  • POST /api/verify/start - Start verification process
  • POST /api/verify/stop - Stop verification process
  • POST /api/verify/trigger - Trigger manual verification batch

Scheduler Control

  • POST /api/scheduler/start - Start automated scheduler
  • POST /api/scheduler/stop - Stop scheduler
  • GET /api/scheduler/status - Get scheduler status

Testing

  • POST /api/test-smtp - Test SMTP configuration
  • GET /api/email-service/stats - Get email service statistics

Usage Examples

Generate Email Combinations

curl -X POST http://localhost:3000/api/generate \
  -H "Content-Type: application/json" \
  -d '{
    "startYear": 2020,
    "endYear": 2024,
    "maxStudentNumber": 10000,
    "includeNameBased": true,
    "includeRandom": true,
    "randomCount": 1000
  }'

Start Automated Verification

curl -X POST http://localhost:3000/api/scheduler/start

Get Statistics

curl http://localhost:3000/api/stats

Test SMTP Configuration

curl -X POST http://localhost:3000/api/test-smtp \
  -H "Content-Type: application/json" \
  -d '{"testEmail": "your-test-email@example.com"}'

Configuration for Multiple SMTP Accounts

To use multiple email accounts for sending:

  1. Gmail Setup (Recommended):

    • Enable 2-factor authentication
    • Generate App Passwords for each account
    • Use App Passwords in SMTP_PASS_X variables
  2. Add Multiple Accounts:

    SMTP_USER_1=account1@gmail.com
    SMTP_PASS_1=app-password-1
    
    SMTP_USER_2=account2@gmail.com
    SMTP_PASS_2=app-password-2
    
    SMTP_USER_3=account3@gmail.com
    SMTP_PASS_3=app-password-3
    # ... add up to 20 accounts

Rate Limiting Strategy

The system implements multiple rate limiting strategies:

  • Per Account: Each SMTP account has daily/hourly limits
  • Global: System-wide rate limiting
  • Batch Processing: Processes emails in small batches
  • Delays: Built-in delays between email sends

Automated Operation

The system can run continuously with:

  • Hourly Verification: Sends 2 emails per hour per account
  • Daily Reports: Generates statistics reports
  • Weekly Generation: Creates new email combinations

Monitoring

Check system status:

# Health check
curl http://localhost:3000/health

# Statistics
curl http://localhost:3000/api/stats

# Scheduler status
curl http://localhost:3000/api/scheduler/status

Production Deployment

For production deployment:

  1. Set NODE_ENV=production
  2. Configure MongoDB Atlas or production MongoDB
  3. Set up proper SMTP accounts with high limits
  4. Use process manager like PM2
  5. Set up monitoring and logging

Security Considerations

  • Use App Passwords for Gmail accounts
  • Implement proper rate limiting
  • Monitor for abuse
  • Use secure MongoDB connections
  • Implement proper error handling

Troubleshooting

Common Issues

  1. SMTP Authentication Failed:

    • Check App Passwords are correct
    • Ensure 2FA is enabled
    • Verify account credentials
  2. Rate Limiting:

    • Reduce MAX_EMAILS_PER_HOUR
    • Add more SMTP accounts
    • Increase delays between batches
  3. MongoDB Connection:

    • Check MongoDB is running
    • Verify connection string
    • Check network connectivity

Logs

Monitor logs for:

  • Email sending success/failure
  • Rate limiting messages
  • Database connection status
  • Scheduler job execution

License

MIT License - Feel free to use and modify for your needs.

About

Automated university email verification system that generates email combinations, sends verification emails via multiple SMTP accounts, and stores valid addresses in MongoDB. Built with Node.js, Express, and Nodemailer.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors