【问题标题】:SMTP -> ERROR: Failed to connect to server: Connection timed out (110)SMTP -> 错误:无法连接到服务器:连接超时 (110)
【发布时间】:2016-10-28 08:34:17
【问题描述】:

我在尝试通过 PHPMailer 发送电子邮件时遇到此错误:

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

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

SMTP 错误:无法连接到 SMTP 主机。


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

【问题讨论】:

  • 您可以尝试另一个端口号以及另一个 SMTPSecure 如 456 , ssl
  • @Soni Vimal 我已经尝试过了,但不起作用。 SparkPost 只使用 TLS 端口 587 和 2525

标签: php phpmailer sparkpost


【解决方案1】:

看起来传出端口在您的服务器中被阻止。您可以尝试使用端口2525

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

【讨论】:

    猜你喜欢
    • 2014-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多