Address Php ((hot)) — Validate Email

// Usage $result = validateEmail("user+tag@example.com"); if ($result['valid']) echo "Valid: " . $result['email'];

foreach ($mxhosts as $mx) $connection = @fsockopen($mx, $port, $errno, $errstr, $timeout); if ($connection) $response = fgets($connection, 4096); fputs($connection, "HELO " . $_SERVER['SERVER_NAME'] . "\r\n"); fgets($connection, 4096); fputs($connection, "MAIL FROM: <noreply@yourdomain.com>\r\n"); fgets($connection, 4096); fputs($connection, "RCPT TO: <$email>\r\n"); $code = fgets($connection, 4096); fclose($connection); if (substr($code, 0, 3) == '250') return true; validate email address php

$email = "user@example.com"; if (filter_var($email, FILTER_VALIDATE_EMAIL)) echo "Valid email address"; else echo "Invalid email address"; // Usage $result = validateEmail("user+tag@example