SMTP - >错误:无法连接到服务器:连接超时(110)

问题描述:

我得到这个错误,同时尝试通过的PHPMailer发送电子邮件:SMTP - >错误:无法连接到服务器:连接超时(110)

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('[email protected]','Verificación de Cuentas'); 
     $mail->AddReplyTo("[email protected]","Soporte SOSgram"); 
     $mail->Subject = $subject; 
     $mail->MsgHTML($message); 
     $mail->Send(); 
    } 

任何解决方案?



托管:http://hostinger.es

SMTP:http://sparkpost.com

+0

您可以尝试另一个端口号以及另一个SMTPSecure *,如456,ssl *。 –

+0

@Soni Vimal我已经试过这个,不起作用。 SparkPost只使用TLS端口587和2525 –

貌似传出口堵住,在您的服务器。您可以尝试使用端口2525

如果这也被阻止,您可以打开其中一个或使用php client library其中使用端口80/443,这是不太可能的这些端口被阻止;