-2

I tried many method to track am email is valid or not before send it. Am using php mailer and swift mail to send emails.Many website told refer the mx record. But it returns only the domain is valid or not. NOt returns the email. For example if i have a domain example.com and i created only mail@example.com ,if i tried to send mail to mailmailme@example.com also returns the email is valid. But i need the result for mailmailme@example.com as invalid before sending this email.

Just like the process in http://www.email-validator.net/

Kevin Reid
  • 37,492
  • 13
  • 80
  • 108
AGK
  • 86
  • 1
  • 13
  • It is not possible to check whether email addr exists or not, until you use some global service which holds zillions of email adresses. But they work only as to catch spam bots and do not distribute email addresses to third hands. I've tried email-validator.net and this is the result: OK - Catch-All Active The mail server for this domain accepts the address, but it also implements a catch-all policy. For this reason, it is not possible to determine if a mail account with this name actually exists, without sending a message and waiting for a reply. So there is not a callback. – Wiggler Jtag Sep 12 '13 at 11:44
  • 1
    Are you basically asking how do you do what this paid for service does without paying for it? – David M Sep 12 '13 at 11:44
  • @WigglerJtag, how do the paid services validate the id of the servers which has catch all enabled?, like the email-validator.net and all others(there are alot of them, all cant have zillions of emails addresses in their db). so there must be a way to validate an email even for catch all servers, what do you think? – scottydelta Jan 19 '14 at 21:35

4 Answers4

1

Try just building

$APIUrl = 'http://www.email-validator.net/api/verify';
$Params = array('EmailAddress' => $Email,
                'APIKey' => '[your API key]');
$Request = @http_build_query($Params);
$ctxData = array(
     'method' => "POST",
     'header' => "Connection: close\r\n".
     "Content-Length: ".strlen($Request)."\r\n",
     'content'=> $Request);
$ctx = @stream_context_create(array('http' => $ctxData));

// send API request
$result = json_decode(@file_get_contents(
    $APIUrl, false, $ctx));

// check API result
if ($result && $result->{'status'} > 0) {
    switch ($result->{'status'}) {
        // valid addresses have a {200, 207, 215} result code
        case 200:
        case 207:
        case 215:
                echo "Address is valid.";
                break;
        case 114;
                // retry
                break;
        default:
                echo "Address is invalid.";
                echo $result->{'info'};
                echo $result->{'details'};
                break;
    }
} else {
    echo $result->{'info'};
}

into your code

0

There is no way to be 100% sure the email is vaild.

What you can try to do is connect to the mail server, start a mail session and "ask" the server to accept mail for the given address.

Some mail servers will return an error if the address is not listed, but others will accept any address, as long as it is in the server's scope.

As for the site you've mentioned, try to check this address for instance: not_a_valid_address@microsoft.com

You will get an answer that the server accepted this address, but it doesn't mean it's a valid one...

Nir Kornfeld
  • 827
  • 7
  • 11
0

Unfortunately it is not possible to verify reliably if an email address is valid or not, because often the server will not send back an error, if the address doesn't exist. This is necessary, because otherwise spammers could just try out email adresses, and could find out which ones are valid and which are not.

martinstoeckli
  • 23,430
  • 6
  • 56
  • 87
0

There is no way to verify if the email is valid or not until you send it. We are using AWS Simple Email Service to send emails. It's good that we can configure the bounce action with it.

https://docs.aws.amazon.com/ses/latest/DeveloperGuide/receiving-email-action-bounce.html

You can specify the SNS topic to send an event when the email is bounced. Additionally, you can process the event and take action according to the error code.

rathourarv
  • 126
  • 1
  • 7