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.
- 🔄 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
npm installCopy env.example to .env and configure your settings:
cp env.example .envEdit .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.zanpm startGET /- API documentationGET /health- Health check
GET /api/stats- Get system statisticsGET /api/verified- Get verified emailsPOST /api/generate- Generate email combinations
POST /api/verify/start- Start verification processPOST /api/verify/stop- Stop verification processPOST /api/verify/trigger- Trigger manual verification batch
POST /api/scheduler/start- Start automated schedulerPOST /api/scheduler/stop- Stop schedulerGET /api/scheduler/status- Get scheduler status
POST /api/test-smtp- Test SMTP configurationGET /api/email-service/stats- Get email service statistics
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
}'curl -X POST http://localhost:3000/api/scheduler/startcurl http://localhost:3000/api/statscurl -X POST http://localhost:3000/api/test-smtp \
-H "Content-Type: application/json" \
-d '{"testEmail": "your-test-email@example.com"}'To use multiple email accounts for sending:
-
Gmail Setup (Recommended):
- Enable 2-factor authentication
- Generate App Passwords for each account
- Use App Passwords in
SMTP_PASS_Xvariables
-
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
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
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
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/statusFor production deployment:
- Set
NODE_ENV=production - Configure MongoDB Atlas or production MongoDB
- Set up proper SMTP accounts with high limits
- Use process manager like PM2
- Set up monitoring and logging
- Use App Passwords for Gmail accounts
- Implement proper rate limiting
- Monitor for abuse
- Use secure MongoDB connections
- Implement proper error handling
-
SMTP Authentication Failed:
- Check App Passwords are correct
- Ensure 2FA is enabled
- Verify account credentials
-
Rate Limiting:
- Reduce
MAX_EMAILS_PER_HOUR - Add more SMTP accounts
- Increase delays between batches
- Reduce
-
MongoDB Connection:
- Check MongoDB is running
- Verify connection string
- Check network connectivity
Monitor logs for:
- Email sending success/failure
- Rate limiting messages
- Database connection status
- Scheduler job execution
MIT License - Feel free to use and modify for your needs.