【发布时间】:2019-02-21 09:32:19
【问题描述】:
我在 PHP 中有一个脚本来使用套接字连接邮件服务器 对基于 Gmail、Yahoo、Hostgator 的邮件地址使用 fsockopen。
一旦套接字连接成功,我必须从中读取数据。 为 Gmail 读取数据时,Yahoo 会在 1 秒内返回,而 Hostgator 和其他人需要 5 秒来读取数据。
所以,我关心的是如何减少时间。
以下是我的脚本:
<?php
$mx = 'gmail-smtp-in.l.google.com'; // It takes only 200ms
//$mx = 'imailv.emirates.net.ae'; // It takes only 400ms
//$mx = 'mail.trantech.com'; // It takes around 6000ms(Problem is
here)
$handle = @fsockopen($mx, 25 , $errno, $errstr, 5);
echo fgets($handle);
?>
【问题讨论】:
标签: php sockets smtp postfix-mta