无法使用phpmailer SMTP发送电子邮件



php脚本

require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
//Passing true to the constructor enables the use of exceptions for error handling
$mail = new PHPMailer(true);
try {
 $mail->Port       = 25;    
 $mail->Timeout = 10;
 $mail->isSMTP();   
 $mail->SMTPDebug = 3;
 $mail->CharSet = 'UTF-8'; 
 $mail->Host       = 'mail1.ClientWeb.com';
 $mail->SMTPAuth   = true; 
 $mail->Username   = 'test_mail@ClientWeb.com'; 
 $mail->Password   = 'pwd';  
 $mail->setFrom('from@example.com', 'First Last');
 $mail->addReplyTo('replyto@example.com', 'First Last');
 $mail->addAddress('keprta.martin@gmail.com', 'Martin Keprta');
 $mail->Subject = 'test';
 $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
 $mail->AltBody = 'This is a plain-text message body';
 $mail->addAttachment('images/phpmailer_mini.png');
 $mail->send();
 echo "Message sent!";
  } catch (phpmailerException $e) {
    echo $e->errorMessage();
  } catch (Exception $e) {
    echo $e->getMessage();
                                     }

问题描述

客户端在他的服务器上有一个显然运行的脚本。我正在尝试连接到他的服务器,但是当我尝试发送电子邮件以下错误时出现错误时出现

2017-05-07 18:31:57 Connection: opening to mail1.warmacher.com:25, timeout=10, options=array ( ) 
2017-05-07 18:31:57 Connection: opened 
2017-05-07 18:32:07 SERVER -> CLIENT: 
2017-05-07 18:32:07 CLIENT -> SERVER: EHLO localhost 
2017-05-07 18:32:17 SERVER -> CLIENT: 
2017-05-07 18:32:17 SMTP ERROR: EHLO command failed: 
2017-05-07 18:32:17 CLIENT -> SERVER: HELO localhost 

据我所知,连接是估计的,但由于某种原因未发送电子邮件。

我在问这个光荣的社区之前采取了步骤

  1. 检查是否需要安全 - 无
  2. 检查端口是否正确-25是正确的
  3. 检查名称/PWD是否正确 - 是的。我可以在服务器

您连接到的邮件服务器有问题。如果我telnet mail1.warmacher.com 25,它会连接,但没有响应。这似乎不是一个问候的延迟对策,它只是破坏了。您设置的短时间不允许SMTP允许的最大等待时间(5分钟(,尽管它似乎无济于事。您的代码很好 - 您需要修复邮件服务器。

  1. 是由未知的后缀服务器设置引起的问题。(基本上这不是问题,而是功能(
  2. 库尔特设置不允许从服务器外部访问邮政编码

最新更新