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

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

我在尝试通过 PHPMailer:

发送电子邮件时遇到此错误

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/u722941258/public_html/old/account/access/mailer/class.phpmailer.php on line 1727

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

SMTP Error: 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 client library,它使用端口 80/443,这些端口被阻止的可能性很小;