How to check if an email id exists?

How to check if email id exists or not using PHP? and get information about the owner of the email id? Can I get information about the owner of the email id? Do I need to work with some protocols, such as POP? Please help me.

+5
source share
2 answers

Suppose a user sends the following email address:

  • stackuser@stackoverflow.com

The checks you want to perform in order are as follows:

  • Is the address valid?
  • Does the domain start the mail server / MX record
  • Into a black list

-, PHP filter_var :

$is_valid = filter_var("stackuser@stackoverflow.com",FILTER_VALIDATE_EMAIL);

-, , , DNS MX :

$has_dns_mx_record = checkdnsrr("stackoverflow.com","MX");

:

$socket = fsockopen("stackoverflow.com", 25);
$mail_running = (bool)$socket;
fclose($socket);

, SMTP- 550- , :

SEND > helo hi
250 stackoverflow.com

SEND > mail from: <youremail@yoursite.com>
250 2.1.0 Ok

SEND > rcpt to: <stackuser@stackoverflow.com>
> 550 5.1.1 <stackuser@stackoverflow.com>: Recipient address rejected: User unknown in local recipient table

, smtp-, helo > mail from <...>, 550.

: http://www.greenend.org.uk/rjk/2000/05/21/smtp-replies.html

@slebetman, , 550, .

, DNSBL, , , , , , ,

, , , .

+12

100% , , - . , , , . DNS , MX. SMTP, , , SMTP- . Centralops.net , , , .

, , , - ? ; , , , .

+13

All Articles