检查是否存在使用TELNET和PHP的电子邮件


Check if a email exists with TELNET and PHP

我在stackoverflow上看过一些关于如何检查电子邮件是否存在的教程,我不太明白如何。。。

方法1

基本上,我必须在cmd.exe中运行以下命令

telnet gmail-smtp-in.l.google.com 25
helo
mail from: <youremail@gmail.com>
rcpt to: <mailtocheck4@gmail.com>

如果回复是"OK",那么我们有一封好的电子邮件。我在.bat文件中插入了所有这些,而bat文件所做的只是连接到telnet并完成。。。

方法2

使用这个http://www.geckotribe.com/php-telnet/#usage连接到telnet,但我不知道我应该提供什么密码

<?php
require_once "PHPTelnet.php";
$telnet = new PHPTelnet();
// if the first argument to Connect is blank,
// PHPTelnet will connect to the local host via 127.0.0.1
$result = $telnet->Connect('mail.gmail.com','usr','password');
if ($result == 0) 
{
    $telnet->DoCommand('helo', $result);
    // NOTE: $result may contain newlines
    echo $result;
    $telnet->DoCommand('another command', $result);
    echo $result;
    // say Disconnect(0); to break the connection without explicitly logging out
    $telnet->Disconnect();
}
?> 

你们能帮帮我吗?

rcpt to之后的ok确认不会验证电子邮件是否存在。它只表示您输入的电子邮件是有效的电子邮件格式。只有当电子邮件没有被退回时,你才会知道它是否不存在。