SMTP→错误:连接服务器失败:连接超时(110)


SMTP -> ERROR: Failed to connect to server: Connection timed out (110)

当我试图通过PHPMailer发送电子邮件时,我得到这个错误:

Deprecated: preg_replace():/e修饰符已弃用,请在/home/u722941258/public_html/old/account/access/mailer/class.phpmailer.php第1727行中使用preg_replace_callback代替。

SMTP→错误:连接服务器失败:Connection timed out (110)

SMTP错误:Could not connect to SMTP host.


PHP代码:
function send_mail($email,$message,$subject)
    {
        require_once('mailer/class.phpmailer.php');
        $mail = new PHPMailer();
        $mail->SMTPDebug = 3;    
        $mail->isSMTP();                                      
        $mail->Host = 'smtp.sparkpostmail.com';  
        $mail->SMTPAuth = true;                               
        $mail->Username = 'USER';                 
        $mail->Password = 'SECRET';                           
        $mail->SMTPSecure = 'tls';                            
        $mail->Port = 587;                                    
        $mail->AddAddress($email);
        $mail->SetFrom('admin@email.sosgram.ga','Verificación de Cuentas');
        $mail->AddReplyTo("soporte@email.sosgram.ga","Soporte SOSgram");
        $mail->Subject  = $subject;
        $mail->MsgHTML($message);
        $mail->Send();
    }

解决方案吗?



托管:http://hostinger.es

SMTP: http://sparkpost.com

看起来您的服务器中的出站端口被阻塞了。您可以尝试使用端口2525

如果也被阻塞,你可以打开其中一个或者使用php客户端库使用80/443端口这些端口不太可能被阻塞