Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8108623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:10:18+00:00 2026-06-06T01:10:18+00:00

How to write a code to check an email is existing or not? For

  • 0

How to write a code to check an email is existing or not? For example donkey_sdh123@gmail.com, donkey_sdh123@yahoo.com, or donkey_sdh123@lycos.com all these emails do not exist in gmail, yahoo and lycos database.
enter image description here

See the screenshot. donkey_sdh123@gmail.com is bad. That means it does not exist. how can i implement the same thing in my project?

javascript, jquery shell script, c or c++ are welcome. Without .net.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T01:10:21+00:00Added an answer on June 6, 2026 at 1:10 am

    See this code i got it from web.

     class SmtpValidator {
    
        private $options = array(
                "port" => 25,
                "timeout" => 1,  // Connection timeout to remote mail server.
                "sender" => "info@webtrafficexchange.com",
                "short_response" => false,
        );
    
        /**
         *  Override the options for those specified.
         */
        function __construct($options = null) {
            if (!empty($options)) {
                if (is_array($options)) {
                    foreach ($options as $key => $value) {
                        $this->options[$key] = $value;
                    }
                }
            }
        }
    
        /**
         *  Validate the email address via SMTP.
         *  If 'shore_response' is true, the method will return true or false;
         *  Otherwise, the entire array of useful information will be provided.
         */
        public function validate($email, $options = null) {
    
            $result = array("valid" => false);
            $errors = array();
    
            // Email address (format) validation
            if (empty($email)) {
                $errors = array("Email address is required.\n");
            } else if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $errors = array("Invalid email address.\n");
            } else {
                list($username, $hostname) = split('@', $email);
                if (function_exists('getmxrr')) {
                    if (getmxrr($hostname, $mxhosts, $mxweights)) {
                        $result['mx_records'] = array_combine($mxhosts, $mxweights);
                        asort($result['mx_records']);
                    } else {
                        $errors = "No MX record found.";
                    }
                }
    
                foreach ($mxhosts as $host) {
                    $fp = @fsockopen($host, $this->options['port'], $errno, $errstr, 
                                           $this->options['timeout']);
                    if ($fp) {
                        $data = fgets($fp);
                        $code = substr($data, 0, 3);
                        if($code == '220') {
                            $sender_domain = split('@', $this->options['sender']);
                            fwrite($fp, "HELO {$sender_domain}\r\n");
                            fread($fp, 4096);
                            fwrite($fp, "MAIL FROM: <{$this->options['sender']}>\r\n");
                            fgets($fp);
                            fwrite($fp, "RCPT TO:<{$email}>\r\n");
                            $data = fgets($fp);
                            $code = substr($data, 0, 3);
                            $result['response'] = array("code" => $code, "data" => $data);
                            fwrite($fp, "quit\r\n");
                            fclose($fp);
                            switch ($code) {
                                case "250":  // We're good, so exit out of foreach loop
                                case "421":  // Too many SMTP connections
                                case "450":
                                case "451":  // Graylisted
                                case "452":
                                    $result['valid'] = true;
                                    break 2;  // Assume 4xx return code is valid.
                                default:
                                    $errors[] = "({$host}) RCPT TO: {$code}: {$data}\n";
                            }
                        } else {
                            $errors[] = "MTA Error: (Stream: {$data})\n";
                        }
                    } else {
                        $errors[] = "{$errno}: $errstr\n";
                    }
                }
            }
            if (!empty($errors)) {
                $result['errors'] = $errors;
            }
            return ($this->options['short_response']) ? $result['valid'] : $result;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to write a function to check key code with JavaScript. It's working
How could I write code to get all the action names from a controller
I have a classic ASP page with some code to check if an email
I need to write php code to routinely check for the feed of a
I'm trying to write code in my controller that when run, will create a
I m trying write code that after reset set up rrpmax as 3000. It
I am trying to write code for getting my cords on the mobile. I
How do I write code to connect through Windows VPN client? I want this
I'm trying to write code that will load an image from a resource, and
When I write code in Python with exception handling I can write code like:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.