需要使用postfix减少响应时间

问题描述 投票:0回答:1

我在PHP中有一个脚本,使用套接字连接邮件服务器,使用fsockopen,用于Gmail,Yahoo,Hostgator的邮件地址。

一旦套接字连接成功,我必须从中读取数据。在阅读Gmail数据时,雅虎会在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
1个回答
0
投票

也许这个解决方案不适合您的工作流程,但您可以使用邮件发送服务(例如SendGrid,Amazon SES),它将允许您:

  • 发送批量电子邮件
  • 使用HTTP API(而不是SMTP)
  • 拥有比使用PHP Script + Infrastructure实现的更好的吞吐量(可能)
© www.soinside.com 2019 - 2024. All rights reserved.