I have one script in PHP to connect mail server using a socket with use of fsockopen for Gmail, Yahoo, Hostgator based mail address.
Once a socket connection is successful, I have to read data from that. When reading data for Gmail, Yahoo it returns within 1 second, while Hostgator and others take 5 seconds to read data.
So, my concern is that how can I reduce the time.
Following is my script :
<?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);
?>
Maybe this solution won't fit your workflow, but you could use a Mail Sending Service (such as SendGrid, Amazon SES) that will allow you to: