从 Yahoo SMTP 获取正确的响应

发布于 2024-10-16 07:41:32 字数 3626 浏览 4 评论 0原文

我尝试通过 php 向 yahoo 收件人发送邮件。 每次连接到 yahoo 时,我都会收到收件人地址的 250 状态代码,即使该地址不存在。我找到了一个从雅虎获取正确状态代码的脚本,但我找不到我在脚本中所做的差异或错误。我尝试发送不同的命令并在多个服务器上运行脚本,但我总是收到 RCPT-TO-命令的 250 响应。 为什么我没有得到正确的回应?我想在收件人不存在时停止我的脚本!

获得正确响应的 verify-email.org 日志:

MX record about yahoo.com exists.
Connection succeeded to g.mx.mail.yahoo.com SMTP.
=220 mta1062.mail.sp2.yahoo.com ESMTP YSmtp service ready
> HELO verify-email.org
=250 mta1062.mail.sp2.yahoo.com
> MAIL FROM: <[email protected]>
=250 sender <[email protected]> ok
> RCPT TO: <[email protected]>
=554 delivery error: dd This user doesn't have a yahoo.com account ([email protected]) [0] - mta1062.mail.sp2.yahoo.com

获得错误响应的脚本日志:

C Connect to h.mx.mail.yahoo.com
S 220 mta1144.mail.mud.yahoo.com ESMTP YSmtp service ready
C HELO my-domain.com
S 250 mta1144.mail.mud.yahoo.com (152.70 ms)
C MAIL FROM: <[email protected]>
S 250 sender <[email protected]> ok (723.29 ms)
C RCPT TO: <[email protected]>
S 250 recipient <[email protected]> ok (152.67 ms)
C Close socket connection
S Connection closed gracefully

您可以在此处找到正常工作的脚本: http://verify-email.org

我的脚本:

    while(preg_match('/^\d\d\d-/', $r = fgets($sock))) {
        $response .= $r;
    }
    $response .= $r;

    return $response;
}

$mxRecord = "a.mx.mail.yahoo.com";
$domain = 'example.com';
$mailFrom = '[email protected]';
$rcptTo = '[email protected]';

$commands = array(
    "HELO ".$domain."\r\n",
    "MAIL FROM: <".$mailFrom.">\r\n",
    "RCPT TO: <".$rcptTo.">\r\n",
//  "DATA\r\n",
//  ... email subject and content
//  ".\r\n",
    "QUIT\r\n"
);

if($sock = fsockopen($mxRecord, 25, $errno, $errstr, 30)) {
    foreach($array as $cmd) {
        echo htmlentities($cmd);
        echo '<br />';
        fwrite($sock, $cmd);
        echo htmlentities(getResponse($sock));
        echo '<hr />';
    }

    fclose($sock);
}
else {
    echo 'no connection';
}
?>

一些信息:

  • 我使用了自己的域(不是 example.com)
  • 该脚本位于我的域所指的服务器上 该
  • 服务器不在任何黑名单上,如 spamhaus.org
  • “邮件发件人”中使用的邮件地址确实存在
  • 我使用 getmxrr() 获取 yahoo.com 的 mx 条目
  • 我尝试过 HELO 和 EHLO ->总是相同的反应

I try to send a mail via php to an yahoo recipient.
Every time I connect to yahoo I get a 250 status code for the recipient address, even if it doesn't exist. I found a script which get the correct status code from yahoo, but I cannot find the differences or mistakes I did in my script. I tried to send different commands and run the script on several servers, but I always get a 250 response for the RCPT-TO-command.
Why do I don't get the correct response? I want to stop my script when a recipient doesn't exist!

Log of verify-email.org which gets the correct response:

MX record about yahoo.com exists.
Connection succeeded to g.mx.mail.yahoo.com SMTP.
=220 mta1062.mail.sp2.yahoo.com ESMTP YSmtp service ready
> HELO verify-email.org
=250 mta1062.mail.sp2.yahoo.com
> MAIL FROM: <[email protected]>
=250 sender <[email protected]> ok
> RCPT TO: <[email protected]>
=554 delivery error: dd This user doesn't have a yahoo.com account ([email protected]) [0] - mta1062.mail.sp2.yahoo.com

Log of my script which gets the wrong response:

C Connect to h.mx.mail.yahoo.com
S 220 mta1144.mail.mud.yahoo.com ESMTP YSmtp service ready
C HELO my-domain.com
S 250 mta1144.mail.mud.yahoo.com (152.70 ms)
C MAIL FROM: <[email protected]>
S 250 sender <[email protected]> ok (723.29 ms)
C RCPT TO: <[email protected]>
S 250 recipient <[email protected]> ok (152.67 ms)
C Close socket connection
S Connection closed gracefully

You can find the script which works properly here: http://verify-email.org

My script:

    while(preg_match('/^\d\d\d-/', $r = fgets($sock))) {
        $response .= $r;
    }
    $response .= $r;

    return $response;
}

$mxRecord = "a.mx.mail.yahoo.com";
$domain = 'example.com';
$mailFrom = '[email protected]';
$rcptTo = '[email protected]';

$commands = array(
    "HELO ".$domain."\r\n",
    "MAIL FROM: <".$mailFrom.">\r\n",
    "RCPT TO: <".$rcptTo.">\r\n",
//  "DATA\r\n",
//  ... email subject and content
//  ".\r\n",
    "QUIT\r\n"
);

if($sock = fsockopen($mxRecord, 25, $errno, $errstr, 30)) {
    foreach($array as $cmd) {
        echo htmlentities($cmd);
        echo '<br />';
        fwrite($sock, $cmd);
        echo htmlentities(getResponse($sock));
        echo '<hr />';
    }

    fclose($sock);
}
else {
    echo 'no connection';
}
?>

Some information:

  • I used my own domain (not example.com)
  • The script is located on the server where my domain refers to
  • The server isn't on any blacklist like spamhaus.org
  • The used mail address in "Mail From" does exist
  • I use getmxrr() to get the mx entries of yahoo.com
  • I tried HELO and EHLO -> always the same response

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓝眼泪 2024-10-23 07:41:32

不要在 verify-email.org 上浪费你的钱。我编写了一个在验证电子邮件地址方面效果很好的类,但是连续几天试图从 Yahoo 返回除 250 Recipient OK 消息之外的任何内容时都遇到了问题。我终于想出了一个解决办法,我将在这里分享,不幸的是,在访问他们的服务器大约 10 次之后,他们阻止了我 12 个小时。然后,我将类从我的开发服务器转移到了一个实时服务器,该服务器具有良好的域名、配置了 rDNS 以及允许我发送电子邮件而不会被列入黑名单的减去域密钥的一切。同样,我只得到了 250 个 SMTP 响应,并且我的 IP 再次因我的解决方案而被封锁。我最终决定分解并购买剧本来“看看他们做了什么不同的事情”。答案是:他们没有做任何不同的事情。事实上,该脚本是垃圾,几乎与您可以在网上找到的任何基本脚本相同。我将其加载到 2 台不同的服务器上,并使用两种不同的配置,严格按照脚本的指示进行操作(只有 1 或 2 条指令),但是,对于与我收到的 554 完全相同的电子邮件地址,得到了相同的 250 响应在网站上。深入挖掘后,我发现这可能是一家电子邮件营销公司在销售该脚本。他们要么与雅虎和其他人有关系,要么调用其他后端系统,我不知道,但我确实知道脚本不起作用。此外,发送给卖家和 SWREG(一家数字河流公司)的电子邮件以及退款请求均未得到回复。我发送了我的结果与网站上显示的屏幕截图。我现在正在向我的信用卡公司提出争议。重点是,不要从 verify-email.org 购买。这是一个骗局。除非你想花掉 45 美元。

我唯一的建议是与专业人士建立业务关系或通过像 ReturnPath 这样的公司(非常非常昂贵)。或者,向每个订阅者发送确认电子邮件。不幸的是,我在一家营销公司工作,该公司无法根据他们与附属合作伙伴制定的规则发送确认电子邮件,因此我必须使用第三方服务(昂贵)或提出其他解决方案。祝你好运。

Do NOT waste your money on verify-email.org. I had written a class that works quite well at verifying email addresses, but had been having problems for days trying to return anything from Yahoo other than a 250 Recipient OK message. I finally came up with a work around which I would share here by unfortunately after hitting their servers about 10 times or so they blocked me for 12 hours. I then moved the class from my dev server to a live server with a good domain name, rDNS configured and everything that would allow me to send emails without getting blacklisted minus domain keys. Again, I got nothing but 250 responses with SMTP and again I got my IP blocked with my work around. I finally decided to break down and buy the script to "see what they're doing different". The answer: They aren't doing anything different. In fact, the script was garbage and almost identical to any rudimentary script you can find online. I loaded it on 2 different server and with two different configurations, followed the directions of the script to the letter ( it was only 1 or 2 instructions) and yet, got the same 250 response for the exact same email address that I received a 554 on the site. Digging a little deeper I found that it was potentially an email marketing company selling the script. They either have a relationship with Yahoo and others or its calling some other backend system, i dont know but I do know the sccript does not work. Furthermore, an emails sent to the seller and SWREG (a digital river company) have gone unanswered as well as a request for a refund. I sent screenshots of my results versus what they display on the site. I am now filing a dispute with my Credit Card company. Point being, DO NOT BUY from verify-email.org. Its a scam. That is unless you feel like pissing away $45.

My only advice is to form business relationships with the majors or go through a company like ReturnPath (very very expensive.) Or, send confirmation emails to each subscriber. I unfortunately work for a marketing company that can't send confirmation emails based on rules they have with their affiliate partners so I have to use a third party service (expensive) or come up with another solution. Good luck.

你在我安 2024-10-23 07:41:32

您阅读 verify-email.org 的常见问题解答了吗? “对于某些域,您无法验证地址是否有效,因为它们的邮件服务器不合作。例如:yahoo.com”

这是因为这些邮件服务器不希望垃圾邮件发送者收集已知良好的电子邮件地址。

Did you read the FAQ of verify-email.org? "For some domains you can't verify whether the address is good or not, because their mail servers don't cooperate. For example: yahoo.com"

This is because these mail servers don't want spammers harvesting known-good email addresses.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文