Skip to content

A powerful, standalone email verification API built from Email Verifier Pro. No authentication required - completely public and free to use.

Notifications You must be signed in to change notification settings

cold-cofffeee/Bulk-Email-Validator-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bulk Email Validator API

A powerful, standalone email verification API built from Email Verifier Pro. No authentication required - completely public and free to use.

PHP Version MySQL Version License Status Author

✨ Latest Updates (v2.0.0)

  • βœ… Automatic Database Setup - One-click installation via setup.html
  • βœ… Fixed Database Schema - Corrected evp_mx_redirect table columns
  • βœ… Enhanced Error Handling - Better SMTP timeout management
  • βœ… Improved Type Safety - Added resource checks for stream operations
  • βœ… Production Ready - All endpoints tested and validated
  • βœ… Port 25 Detection - Graceful handling when SMTP port is blocked
  • βœ… Test Suite Included - test-no-smtp.py for non-SMTP testing

πŸ“– Table of Contents

  1. About
  2. Features
  3. How It Works
  4. Requirements
  5. Quick Installation
  6. Configuration
  7. API Endpoints
  8. Usage Examples
  9. Advanced Features
  10. Database Schema
  11. Rate Limiting & Caching
  12. Testing
  13. Deployment
  14. Troubleshooting
  15. Security

🎯 About

This API is a complete replication of Email Verifier Pro (CodeCanyon webapp), converted into a standalone REST API. It provides the same powerful email verification capabilities with 100% accuracy matching the original webapp.

What Makes This Special?

Built From Email Verifier Pro:

  • Same validation logic and algorithms
  • Same database-driven features
  • Same SMTP verification protocol
  • Same accuracy and reliability

Key Differences:

  • βœ… REST API instead of web interface
  • βœ… JSON responses instead of HTML
  • βœ… Public access (no authentication required)
  • βœ… Can be hosted anywhere
  • βœ… Used worldwide without restrictions

Perfect For

  • πŸ“§ Form validation in real-time
  • 🧹 Email list cleaning and validation
  • βœ… User registration verification
  • πŸ“¬ Newsletter signup validation
  • πŸ“ Contact form verification
  • πŸ’Ό CRM data validation
  • πŸ“Š Bulk email list processing

πŸš€ Features

Core Verification Features

Feature Description
Syntax Validation RFC 5322 compliant email format checking
DNS Validation Verify domain exists with valid DNS records
MX Records Check mail exchange records for email delivery
SMTP Verification Real-time SMTP server validation (EHLO, MAIL FROM, RCPT TO)
Disposable Detection Database-driven disposable domain detection (11+ domains pre-loaded)
Free Account Detection Identify free email providers (Gmail, Yahoo, Outlook, etc.)
Catch-All Detection Smart detection of catch-all mail servers
Role-Based Detection Identify role accounts (admin@, info@, support@, etc.)

Advanced Features (Replicated from Email Verifier Pro)

Feature Description
Domain Filter Lists Database table with disposable/unsupported domains
MX Skip Lists Auto-detects and skips problematic MX servers
MX Redirections Domain-specific MX record redirections from database
Configurable SMTP Port, timeout, commands stored in database
Email Scoring 0-1 score indicating deliverability confidence
Safe-to-Send Clear Yes/No/Maybe recommendations
Bounce Type Detection Hard bounce vs soft bounce classification
Debug Mode Complete SMTP conversation logging

API Features

  • βœ… Public Access: No API keys required - completely open
  • βœ… Rate Limiting: IP-based fair usage (50 requests/hour per IP)
  • βœ… Single Verification: Verify one email at a time
  • βœ… Bulk Verification: Process up to 100 emails in one request
  • βœ… Smart Caching: 24-hour result caching for performance
  • βœ… Statistics: Monitor usage and verification metrics
  • βœ… RESTful Design: Clean, predictable JSON responses
  • βœ… CORS Enabled: Use directly from browsers
  • βœ… Logging: Track all verifications and errors

πŸ” How It Works

Verification Process Flow

1. Syntax Check
   ↓
2. Domain DNS Lookup
   ↓
3. MX Record Retrieval
   ↓
4. MX Skip List Check (auto-populated problematic servers)
   ↓
5. Disposable Domain Check (database)
   ↓
6. MX Redirection Check (database)
   ↓
7. SMTP Connection Test
   β”‚
   β”œβ”€β†’ EHLO/HELO Command
   β”œβ”€β†’ MAIL FROM Command
   β”œβ”€β†’ RCPT TO Command (verify recipient)
   └─→ Response Code Analysis (220, 250, 450, 550, etc.)
   ↓
8. Catch-All Detection (random email test)
   ↓
9. Email Scoring & Classification
   ↓
10. Return Results (JSON)

Validation Levels

Level 1: Syntax (Instant)

  • Format validation (RFC 5322)
  • No network requests
  • < 0.01 seconds

Level 2: DNS (Fast)

  • Domain existence check
  • MX record lookup
  • 0.1-0.5 seconds

Level 3: SMTP (Thorough)

  • Real mail server connection
  • SMTP conversation
  • Response code analysis
  • 1-5 seconds

Level 4: Advanced (Comprehensive)

  • Disposable detection
  • Catch-all detection
  • MX skip list check
  • Email scoring
  • 2-10 seconds

Technology Stack

  • PHP: Core language (7.4+)
  • MySQL: Data storage and configuration
  • Functions Used:
    • filter_var() - Email syntax validation
    • checkdnsrr() - DNS record checks
    • getmxrr() - MX record retrieval
    • fsockopen() - SMTP socket connection
    • fgets()/fputs() - SMTP communication
  • Database: 8 tables for configuration, caching, logging
  • Apache: Web server with mod_rewrite

πŸ“‹ Requirements

Server Requirements

  • PHP: 7.4 or higher (8.0+ recommended)
  • MySQL: 5.7 or higher (8.0+ recommended)
  • Web Server: Apache with mod_rewrite enabled
  • PHP Extensions:
    • mysqli - Database operations
    • curl - API functionality
    • sockets - SMTP verification
    • json - API responses
    • mbstring - String handling

Network Requirements

  • Port 25: Outbound access for SMTP verification (critical)
  • Port 80/443: Inbound for API access

Hosting Compatibility

βœ… Works On:

  • Shared Hosting (cPanel, Plesk) - if port 25 allowed
  • VPS/Dedicated Servers
  • Cloud (AWS, Azure, DigitalOcean, Linode)
  • Local Development (XAMPP, WAMP, MAMP, LAMP)

⚠️ Note: Some shared hosts block port 25 for SMTP. Check with your provider.


πŸ’» Quick Installation

⚑ Automatic Setup (Recommended)

Super Simple - Just 3 Steps!

Step 1: Clone or Download

git clone https://github.com/cold-cofffeee/Bulk-Email-Validator-API.git
cd Bulk-Email-Validator-API

Or download ZIP and extract to your web server directory (e.g., C:\xampp\htdocs\API).

Step 2: Configure Database Credentials

Edit config/config.php and update your MySQL credentials:

define('DB_HOST', 'localhost');
define('DB_USER', 'root');              // Your MySQL username
define('DB_PASS', '');                  // Your MySQL password
define('DB_NAME', 'email_verify_api');  // Database name (will be created automatically)

Step 3: Run Setup Page

Open your browser and visit:

http://localhost/API/setup.html

Click "Install Database Automatically" and you're done! πŸŽ‰

The system will automatically:

  • βœ… Create the database
  • βœ… Create all 8 tables
  • βœ… Insert default data (11 disposable domains, SMTP settings, etc.)
  • βœ… Configure everything for you

That's it! No SQL imports, no manual configuration needed.


πŸ”§ Manual Installation (Alternative)

If you prefer manual setup:

Step 1: Clone repository

git clone https://github.com/cold-cofffeee/Bulk-Email-Validator-API.git
cd Bulk-Email-Validator-API

Step 2: Create database

mysql -u root -p
CREATE DATABASE email_verify_api CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
EXIT;

Step 3: Import schema

mysql -u root -p email_verify_api < database/schema.sql

Step 4: Update config/config.php with your database credentials

Step 5: Test installation

http://localhost/API/

πŸ“Š What Gets Created

The automatic setup creates 8 tables:

API Tables (4):

  • rate_limits - IP request tracking for rate limiting
  • verification_logs - Complete verification history
  • verification_cache - 24-hour result caching
  • api_stats - Daily usage statistics

Email Verifier Pro Tables (4):

  • evp_domain_filter_list - Disposable/free domains (11 pre-loaded)
  • evp_mx_skiplist - Problematic MX servers (auto-populated)
  • evp_mx_redirect - Domain MX redirections
  • evp_options - SMTP configuration (port, timeout, commands)

βœ… Verify Installation

Visit http://localhost/API/ - you should see:

{
  "name": "Email Verification API",
  "version": "1.0.0",
  "description": "Public email verification API",
  "status": "active",
  "public": true
  "endpoints": {
    "verify": "/verify",
    "bulk": "/verify/bulk",
    "health": "/health",
    "stats": "/stats",
    "docs": "/docs"
  }
}

βœ… Installation Complete!


πŸ”§ Configuration

Application Config (config/config.php)

// Database Connection
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'email_verify_api');

// Rate Limiting
define('ENABLE_RATE_LIMIT', true);
define('RATE_LIMIT_REQUESTS', 50);        // Requests per hour per IP
define('RATE_LIMIT_WINDOW', 3600);        // 1 hour in seconds

// Result Caching
define('CACHE_RESULTS', true);
define('CACHE_DURATION', 86400);          // 24 hours

// Bulk Verification
define('BULK_VERIFY_LIMIT', 100);         // Max emails per bulk request

// Email Verification (Defaults - can override via database)
define('VERIFY_PORT', 25);                // SMTP port
define('VERIFY_FROM', 'verify@localhost'); // FROM email address
define('VERIFY_TIMEOUT', 30);             // Connection timeout (seconds)
define('CHECK_MX_RECORDS', true);         // Enable MX checks
define('CHECK_SMTP', true);               // Enable SMTP verification
define('CHECK_DISPOSABLE', true);         // Check disposable domains

// Logging
define('ENABLE_LOGGING', true);           // Log verifications
define('LOG_FILE', __DIR__ . '/../logs/error.log');

Database Config (evp_options table)

These settings override config.php defaults:

Option Description Default
scan_port SMTP port 25
scan_mail FROM email verify@localhost
scan_time_out Timeout (seconds) 30
smtp_cmd SMTP command EHLO localhost

Update Options:

UPDATE evp_options SET option_value = 'verify@yourdomain.com' WHERE option_name = 'scan_mail';
UPDATE evp_options SET option_value = '60' WHERE option_name = 'scan_time_out';
UPDATE evp_options SET option_value = 'EHLO mail.yourdomain.com' WHERE option_name = 'smtp_cmd';

πŸ“– API Endpoints

Base URL

http://yourdomain.com/API/

1. API Information

GET /

Response:

{
  "name": "Email Verification API",
  "version": "1.0.0",
  "status": "active",
  "public": true,
  "endpoints": {...}
}

2. Single Email Verification

POST /verify
Content-Type: application/json

{
  "email": "user@example.com",
  "debug": false
}

Parameters:

  • email (string, required) - Email address to verify
  • debug (boolean, optional) - Enable SMTP debug logging (default: false)

Success Response:

{
  "success": true,
  "data": {
    "email": "user@example.com",
    "valid": true,
    "status": "Valid",
    "reason": "Deliverable",
    "details": {
      "username": "user",
      "domain": "example.com",
      "syntax_valid": true,
      "dns_valid": true,
      "mx_records": true,
      "smtp_valid": true,
      "disposable": false,
      "role_based": false,
      "mx_servers": ["mx1.example.com", "mx2.example.com"]
    },
    "mx_server": "mx1.example.com",
    "mx_response": "250 2.1.5 OK",
    "email_score": 1,
    "safe_to_send": "Yes",
    "bounce_type": "",
    "type": "Corporate Account",
    "verification_time": "2.34 seconds",
    "cached": false
  },
  "timestamp": "2024-12-03T10:30:00+00:00"
}

Error Response:

{
  "success": false,
  "error": {
    "message": "Invalid email format",
    "code": 400
  },
  "timestamp": "2024-12-03T10:30:00+00:00"
}

3. Bulk Email Verification

POST /verify/bulk
Content-Type: application/json

{
  "emails": [
    "user1@example.com",
    "user2@example.com",
    "user3@example.com"
  ]
}

Parameters:

  • emails (array, required) - Array of email addresses (max 100)

Response:

{
  "success": true,
  "data": {
    "total": 3,
    "processed": 3,
    "verification_time": "5.67 seconds",
    "results": [
      {
        "email": "user1@example.com",
        "valid": true,
        "status": "Valid",
        "reason": "Deliverable",
        "email_score": 1,
        "safe_to_send": "Yes"
      },
      {
        "email": "user2@example.com",
        "valid": false,
        "status": "Invalid",
        "reason": "Domain does not exist",
        "email_score": 0,
        "safe_to_send": "No"
      },
      {
        "email": "user3@example.com",
        "valid": true,
        "status": "Unknown",
        "reason": "Catch-all server detected",
        "email_score": 0.5,
        "safe_to_send": "Maybe"
      }
    ]
  },
  "timestamp": "2024-12-03T10:30:00+00:00"
}

4. Health Check

GET /health

Response:

{
  "status": "healthy",
  "database": "connected",
  "php_version": "8.0.28",
  "mysql_version": "8.0.32",
  "timestamp": "2024-12-03T10:30:00+00:00"
}

5. API Statistics

GET /stats

Response:

{
  "success": true,
  "data": {
    "total_verifications": 15420,
    "last_24_hours": 523,
    "cached_results": 3421,
    "verifications_by_status": {
      "Valid": 12340,
      "Invalid": 2580,
      "Unknown": 500
    },
    "verifications_today": 247,
    "rate_limit": {
      "enabled": true,
      "requests_per_hour": 50,
      "window": 3600
    },
    "cache": {
      "enabled": true,
      "duration": 86400
    }
  },
  "timestamp": "2024-12-03T10:30:00+00:00"
}

6. Documentation

GET /docs

Returns HTML documentation page.


Error Codes

Code Message Description
400 Bad Request Invalid input (missing email, invalid format)
429 Rate Limit Exceeded Too many requests from IP
500 Internal Server Error Server-side error

πŸ’‘ Usage Examples

cURL

Single Verification:

curl -X POST http://localhost/API/verify \
  -H "Content-Type: application/json" \
  -d '{"email":"test@gmail.com"}'

With Debug Mode:

curl -X POST http://localhost/API/verify \
  -H "Content-Type: application/json" \
  -d '{"email":"test@gmail.com","debug":true}'

Bulk Verification:

curl -X POST http://localhost/API/verify/bulk \
  -H "Content-Type: application/json" \
  -d '{"emails":["test1@gmail.com","test2@yahoo.com","test3@outlook.com"]}'

Get Statistics:

curl http://localhost/API/stats

JavaScript (Fetch API)

// Single Verification
async function verifyEmail(email) {
  const response = await fetch('http://localhost/API/verify', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ email: email })
  });
  
  const data = await response.json();
  console.log(data);
  return data;
}

verifyEmail('test@example.com');

// Bulk Verification
async function verifyBulk(emails) {
  const response = await fetch('http://localhost/API/verify/bulk', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ emails: emails })
  });
  
  const data = await response.json();
  console.log(data);
  return data;
}

verifyBulk(['user1@example.com', 'user2@example.com']);

Python

import requests
import json

# Single Verification
def verify_email(email):
    url = 'http://localhost/API/verify'
    payload = {'email': email}
    headers = {'Content-Type': 'application/json'}
    
    response = requests.post(url, json=payload, headers=headers)
    return response.json()

result = verify_email('test@gmail.com')
print(json.dumps(result, indent=2))

# Bulk Verification
def verify_bulk(emails):
    url = 'http://localhost/API/verify/bulk'
    payload = {'emails': emails}
    headers = {'Content-Type': 'application/json'}
    
    response = requests.post(url, json=payload, headers=headers)
    return response.json()

emails = ['user1@example.com', 'user2@example.com', 'user3@example.com']
result = verify_bulk(emails)
print(json.dumps(result, indent=2))

PHP

<?php
// Single Verification
function verifyEmail($email) {
    $url = 'http://localhost/API/verify';
    $data = json_encode(['email' => $email]);
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data)
    ]);
    
    $result = curl_exec($ch);
    curl_close($ch);
    
    return json_decode($result, true);
}

$result = verifyEmail('test@gmail.com');
print_r($result);

// Bulk Verification
function verifyBulk($emails) {
    $url = 'http://localhost/API/verify/bulk';
    $data = json_encode(['emails' => $emails]);
    
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type: application/json'
    ]);
    
    $result = curl_exec($ch);
    curl_close($ch);
    
    return json_decode($result, true);
}

$emails = ['user1@example.com', 'user2@example.com'];
$result = verifyBulk($emails);
print_r($result);
?>

πŸ”₯ Advanced Features

1. Email Scoring System

Every verified email receives a deliverability score from 0 to 1:

Score Meaning Safe to Send?
1.0 Valid and deliverable Yes
0.5-0.9 Uncertain (catch-all, greylisting) Maybe
0.0-0.4 Invalid or risky No

2. MX Skip List (Auto-Learning)

The system automatically detects and skips problematic MX servers:

Auto-Added When:

  • Connection timeout
  • Greylisting detected
  • Consistent verification failures

View Skip List:

SELECT * FROM evp_mx_skiplist;

Manually Add:

INSERT INTO evp_mx_skiplist (mx_server, reason) 
VALUES ('problematic-mx.example.com', 'Greylisting');

3. Disposable Domain Detection

Pre-loaded with 11 disposable domains, including:

  • guerrillamail.com
  • 10minutemail.com
  • temp-mail.org
  • And more...

Add More:

INSERT INTO evp_domain_filter_list (name, e_type, catch_all_check) 
VALUES ('newdisposable.com', 'Disposable Account', 0);

4. Catch-All Detection

Detects domains that accept all emails (catch-all servers):

  • Tests with random email address
  • Compares response codes
  • Marks as "Unknown" status
  • Returns score: 0.5 (uncertain)

Configure Per-Domain:

UPDATE evp_domain_filter_list 
SET catch_all_check = 1 
WHERE name = 'example.com';

5. Bounce Type Detection

Classifies non-deliverable emails:

Bounce Type Description SMTP Code
Hard Bounce Permanent failure 550, 551, 554
Soft Bounce Temporary failure 450, 451, 452
Unknown Cannot determine Other codes

6. Debug Mode

Enable comprehensive SMTP logging:

{
  "email": "test@gmail.com",
  "debug": true
}

Debug Output Includes:

{
  "debug": [
    "Email syntax is valid",
    "Valid Domain DNS Record Found",
    "Valid MX Records Found",
    "Trying to connect to: gmail-smtp-in.l.google.com",
    "Connection success",
    "SENT: EHLO localhost",
    "RECV: 250-mx.google.com at your service",
    "SENT: MAIL FROM: <verify@localhost>",
    "RECV: 250 2.1.0 OK",
    "SENT: RCPT TO: <test@gmail.com>",
    "RECV: 250 2.1.5 OK",
    "SENT: QUIT",
    "Connection closed"
  ]
}

πŸ’Ύ Database Schema

Table: rate_limits

Tracks API requests per IP for rate limiting.

Column Type Description
id INT Primary key
ip_address VARCHAR(45) Client IP
request_count INT Number of requests
window_start DATETIME Rate limit window start

Table: verification_logs

Stores all verification attempts.

Column Type Description
id INT Primary key
email VARCHAR(255) Verified email
result VARCHAR(50) Valid/Invalid/Unknown
details TEXT JSON details
ip_address VARCHAR(45) Client IP
created_at DATETIME Timestamp

Table: verification_cache

Caches results for 24 hours.

Column Type Description
id INT Primary key
email VARCHAR(255) Cached email (UNIQUE)
result TEXT JSON result
created_at DATETIME Cache timestamp

Table: api_stats

Daily statistics tracking.

Column Type Description
id INT Primary key
date DATE Statistics date
total_requests INT Total verifications
valid_count INT Valid emails
invalid_count INT Invalid emails
unknown_count INT Unknown emails

Table: evp_domain_filter_list

Disposable and unsupported domains.

Column Type Description
id INT Primary key
name VARCHAR(255) Domain name
e_type VARCHAR(100) Type (Disposable/Unsupported/Free)
catch_all_check TINYINT Enable catch-all check (0/1)

Pre-Loaded Domains:

  • guerrillamail.com
  • 10minutemail.com
  • temp-mail.org
  • throwaway.email
  • mailinator.com
  • And 6 more...

Table: evp_mx_skiplist

Problematic MX servers (auto-populated).

Column Type Description
id INT Primary key
mx_server VARCHAR(255) MX hostname
reason VARCHAR(255) Why skipped
added_at DATETIME When added

Table: evp_mx_redirect

Domain-specific MX redirections.

Column Type Description
id INT Primary key
domain VARCHAR(255) Source domain
redirect_mx VARCHAR(255) Target MX server

Table: evp_options

System configuration options.

Column Type Description
id INT Primary key
option_name VARCHAR(100) Setting name
option_value TEXT Setting value

Default Options:

  • scan_port = 25
  • scan_mail = verify@localhost
  • scan_time_out = 30
  • smtp_cmd = EHLO localhost

🚦 Rate Limiting & Caching

Rate Limiting

Default Limits:

  • 50 requests per hour per IP
  • Applies to /verify and /verify/bulk endpoints
  • Not applied to /health, /stats, /docs

When Limit Exceeded:

{
  "success": false,
  "error": {
    "message": "Rate limit exceeded. Try again in 1234 seconds.",
    "code": 429
  }
}

Adjust Limits:

// config/config.php
define('RATE_LIMIT_REQUESTS', 100);  // Change to 100/hour
define('RATE_LIMIT_WINDOW', 3600);   // Keep 1 hour window

Clear Rate Limits:

TRUNCATE TABLE rate_limits;

Result Caching

Cache Duration: 24 hours (86400 seconds)

Benefits:

  • Faster responses for repeated emails
  • Reduced server load
  • Saves SMTP quota

Cached Response Example:

{
  "data": {
    "email": "test@gmail.com",
    "valid": true,
    "cached": true,  ← Cached result
    ...
  }
}

Clear Cache:

TRUNCATE TABLE verification_cache;

Disable Caching:

// config/config.php
define('CACHE_RESULTS', false);

πŸ§ͺ Testing

Quick Tests

1. API Information:

curl http://localhost/API/

2. Health Check:

curl http://localhost/API/health

3. Valid Email:

curl -X POST http://localhost/API/verify \
  -H "Content-Type: application/json" \
  -d '{"email":"test@gmail.com"}'

4. Invalid Email:

curl -X POST http://localhost/API/verify \
  -H "Content-Type: application/json" \
  -d '{"email":"fake@nonexistentdomain12345.com"}'

5. Disposable Email:

curl -X POST http://localhost/API/verify \
  -H "Content-Type: application/json" \
  -d '{"email":"test@guerrillamail.com"}'

6. Bulk Verification:

curl -X POST http://localhost/API/verify/bulk \
  -H "Content-Type: application/json" \
  -d '{"emails":["test@gmail.com","fake@test.com","admin@yahoo.com"]}'

🌐 Deployment

Shared Hosting (cPanel)

  1. Upload files via FTP/File Manager
  2. Create MySQL database via cPanel
  3. Import database/schema.sql via phpMyAdmin
  4. Edit config/config.php with database credentials
  5. Access via http://yourdomain.com/API/

Important: Check if port 25 is open for SMTP verification.


VPS/Dedicated Server

Requirements:

  • Apache 2.4+ with mod_rewrite
  • PHP 7.4+ (8.0+ recommended)
  • MySQL 5.7+ (8.0+ recommended)

Setup:

# Install dependencies
sudo apt update
sudo apt install apache2 php php-mysqli php-curl mysql-server

# Enable mod_rewrite
sudo a2enmod rewrite
sudo systemctl restart apache2

# Clone repository
cd /var/www/html
git clone https://github.com/cold-cofffeee/API.git
cd API

# Set permissions
sudo chown -R www-data:www-data logs/ cache/
sudo chmod 755 logs/ cache/

# Create database
mysql -u root -p
CREATE DATABASE email_verify_api;
USE email_verify_api;
SOURCE database/schema.sql;
EXIT;

# Configure
nano config/config.php  # Update database credentials

Docker (Optional)

Create Dockerfile:

FROM php:8.0-apache

RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN a2enmod rewrite

COPY . /var/www/html/
WORKDIR /var/www/html/

RUN chown -R www-data:www-data logs/ cache/

EXPOSE 80

Create docker-compose.yml:

version: '3.8'
services:
  web:
    build: .
    ports:
      - "80:80"
    volumes:
      - .:/var/www/html
    depends_on:
      - db
  
  db:
    image: mysql:8.0
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: email_verify_api
    ports:
      - "3306:3306"

Run:

docker-compose up -d
docker exec -i <container_name> mysql -uroot -proot email_verify_api < database/schema.sql

πŸ› Troubleshooting

Database Connection Failed

Error: Could not connect to database

Solution:

  1. Check MySQL is running: sudo systemctl status mysql
  2. Verify credentials in config/config.php
  3. Test connection:
mysql -u root -p -h localhost

500 Internal Server Error

Possible Causes:

  • .htaccess syntax error
  • mod_rewrite not enabled
  • PHP errors

Solution:

  1. Check Apache error log:
tail -f /var/log/apache2/error.log
  1. Enable mod_rewrite:
sudo a2enmod rewrite
sudo systemctl restart apache2
  1. Check logs/error.log for PHP errors

SMTP Verification Fails

Error: SMTP verification failed

Common Causes:

  • Port 25 blocked by firewall/ISP
  • Mail server greylisting
  • Timeout too short

Solutions:

  1. Check Port 25 Access (Most Common Issue):
# Windows PowerShell
Test-NetConnection gmail-smtp-in.l.google.com -Port 25

# Linux/Mac
telnet gmail-smtp-in.l.google.com 25
# Or
nc -zv gmail-smtp-in.l.google.com 25

If port 25 is blocked:

  • βœ… Syntax validation, DNS, MX, and disposable detection still work
  • ❌ Only SMTP server verification and catch-all detection won't work
  • πŸ”§ Contact your ISP/hosting provider to unblock port 25
  • 🌐 Most residential ISPs block port 25 to prevent spam
  • πŸ’‘ Use VPS/cloud hosting (AWS, DigitalOcean, Vultr) where port 25 is open
  1. Test Without SMTP (if port 25 blocked):
python test-no-smtp.py

This tests all endpoints that don't require port 25.

  1. Increase Timeout:
UPDATE evp_options SET option_value = '60' WHERE option_name = 'scan_time_out';

Or edit config/config.php:

define('VERIFY_TIMEOUT', 60);  // Increase to 60 seconds
  1. Check MX Skip List:
SELECT * FROM evp_mx_skiplist;

Remove any domains you want to verify:

DELETE FROM evp_mx_skiplist WHERE mx_server LIKE '%gmail%';

Rate Limit Too Restrictive

Solution:

// config/config.php
define('RATE_LIMIT_REQUESTS', 100);  // Increase to 100/hour

Or clear existing limits:

TRUNCATE TABLE rate_limits;

Logs Directory Not Writable

Error: Warning: fopen(logs/error.log): failed to open stream

Solution:

chmod 755 logs/
chown www-data:www-data logs/  # Linux

πŸ”’ Security

Built-In Protection

βœ… SQL Injection Prevention

  • Prepared statements
  • Input escaping
  • Parameter binding

βœ… XSS Protection

  • JSON responses only
  • No HTML rendering
  • Content-Type headers

βœ… Rate Limiting

  • IP-based tracking
  • Prevents abuse
  • Configurable limits

βœ… Input Validation

  • Email format validation
  • Array size limits
  • Type checking

βœ… Error Handling

  • No sensitive data exposure
  • Generic error messages
  • Detailed logging (server-side only)

Recommendations

1. Use HTTPS in Production:

# .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

2. Restrict Database User:

CREATE USER 'api_user'@'localhost' IDENTIFIED BY 'strong_password';
GRANT SELECT, INSERT, UPDATE, DELETE ON email_verify_api.* TO 'api_user'@'localhost';
FLUSH PRIVILEGES;

3. Keep Logs Secure:

chmod 640 logs/error.log
chown www-data:www-data logs/error.log

4. Regular Updates:

  • Keep PHP updated
  • Keep MySQL updated
  • Monitor security advisories

5. Firewall Rules:

# Allow HTTP/HTTPS
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Allow MySQL (local only)
sudo ufw allow from 127.0.0.1 to any port 3306

πŸ“Š Project Structure

API/
β”œβ”€β”€ .git/                      # Git repository
β”œβ”€β”€ .gitattributes             # Git attributes
β”œβ”€β”€ .gitignore                 # Git ignore rules
β”œβ”€β”€ .htaccess                  # Apache rewrite + CORS
β”œβ”€β”€ index.php                  # API entry point
β”œβ”€β”€ README.md                  # This file
β”‚
β”œβ”€β”€ config/
β”‚   └── config.php             # Configuration
β”‚
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ bootstrap.php          # Autoloader
β”‚   β”œβ”€β”€ Database.php           # MySQL wrapper
β”‚   β”œβ”€β”€ APIRouter.php          # Request routing
β”‚   └── RateLimiter.php        # Rate limiting
β”‚
β”œβ”€β”€ controllers/
β”‚   β”œβ”€β”€ VerifyController.php   # Verification logic
β”‚   └── StatsController.php    # Statistics
β”‚
β”œβ”€β”€ lib/
β”‚   └── EmailVerifier.php      # Email verification engine
β”‚
β”œβ”€β”€ database/
β”‚   └── schema.sql             # Database schema (8 tables)
β”‚
β”œβ”€β”€ logs/                      # Error logs (auto-created)
└── cache/                     # Cache data (auto-created)

Total Files: 23
Total Size: ~0.11 MB
Lines of Code: ~2,500


πŸ“„ License

This project is open source and available for anyone to use, modify, and distribute.

Based on: Email Verifier Pro (CodeCanyon)
Converted by: cold-cofffeee
GitHub: https://github.com/cold-cofffeee/API


🀝 Contributing

Contributions welcome! Feel free to:

  • πŸ› Report bugs
  • ✨ Suggest features
  • πŸ”§ Submit pull requests
  • πŸ“– Improve documentation

πŸ’¬ Support

Issues?

  1. Check Troubleshooting section
  2. Review logs/error.log
  3. Test database connection
  4. Verify PHP extensions

Need Help?


πŸŽ‰ Acknowledgments

  • Email Verifier Pro - Original webapp from CodeCanyon
  • PHP Community - For excellent documentation
  • Contributors - For improvements and bug reports

πŸ“ˆ Changelog

Version 1.0.0 (December 2024)

  • βœ… Initial release
  • βœ… Complete Email Verifier Pro replication
  • βœ… 100% accuracy matching original webapp
  • βœ… Public API without authentication
  • βœ… 8 database tables with advanced features
  • βœ… IP-based rate limiting
  • βœ… Result caching
  • βœ… Comprehensive documentation

Built with ❀️ using PHP | Public & Free | No Authentication Required

Star ⭐ this repo if you find it useful!

About

A powerful, standalone email verification API built from Email Verifier Pro. No authentication required - completely public and free to use.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published