SMTP->错误:无法连接到服务器:连接被拒绝(111) [英] SMTP -> ERROR: Failed to connect to server: Connection refused (111)

查看:192
本文介绍了SMTP->错误:无法连接到服务器:连接被拒绝(111)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立一个网站,我经过大量研究后选择了PHPMAILER,因此我需要实现一个表单发送选项.我将脚本设置为使用我的gmail地址进行测试,并且可以正常工作,但是当我向客户输入电子邮件详细信息时,它不起作用.

Im building a site and I need to implement a form sending option, after a lot of research I settled on PHPMAILER. I set my script to work with my gmail address for testing purposes and it works fine, but when I inputted the clients email details it doesnt work.

我提交申请时,这就是我得到的

When I submit the application, this is what i am getting

SMTP->错误:无法连接到服务器:连接被拒绝(111)

我联系了支持人员并验证了端口和主机,并联系了客户端并验证了登录信息.还有其他原因可能导致它无法正常工作吗?

I contacted support and verified the port and host, and contacted the client and verified the login info. Is there another reason why it might not be working?

更新我制作了一个小脚本,可以轻松测试设置

Update I made a small script that allows me to easily test settings

<?php 
require 'classes/class.phpmailer.php';
require 'classes/class.smtp.php';

$mail = new PHPMailer(true); 
$mail->IsSMTP(); 
try{
    $mail->SMTPDebug  = 1;                     
    $mail->SMTPAuth   = true;                  
    //$mail->SMTPSecure = "ssl";no                
    $mail->Host       = "smtp.domain.com";      
    $mail->Port       = 25;                  
    $mail->Username   = "username";//user@domain.com
    $mail->Password   = "pwd";           
    $mail->AddAddress('alme1304@gmail.com');//RECIPIENT
    //$mail->SetFrom('name@yourdomain.com', 'First Last');//IDK WHAT 'THIS' IS FOR
    //$mail->AddReplyTo($_POST['email'], $_POST['f_name'].' '.$_POST['l_name']);//FOR THE 'REPLY-TO' FIELD
    $mail->Subject = 'test email';
    $mail->MsgHTML('test_email');

    $mail->Send();
} catch (phpmailerException $e) {
    echo $e->errorMessage(); //Pretty error messages from PHPMailer
    echo $mail->Host;
    echo '<pre>';
    print_r($mail);
    echo '</pre>';

} catch (Exception $e) {
    echo $e->getMessage(); //Boring error messages from anything else!
}

推荐答案

我曾与一些主机托管公司合作,他们声称您可以使用smtp.domain.com,但您不能使用.代替托管服务提供商的SMTP服务器,而要使用smtp.domain.com(通常可以从其知识库或支持中获取它们)

I have had experiences with hosts who claim you can use smtp.domain.com yet you cannot. Instead of smtp.domain.com, use the hosting provider's SMTP servers (you can usually get these from their knowledge base or support)

还要验证端口,许多端口不使用25,但可以使用26或其他端口(从知识库或支持人员获得)

Also verify the port, many do not use 25 but may use 26, or some other (get from knowledge base or support)

如果您让我们知道托管服务提供商是谁,我们可能会为您提供更好的帮助

We may be of better assistance if you let us know who the hosting provider is

这篇关于SMTP->错误:无法连接到服务器:连接被拒绝(111)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆