Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
检查PHP编译器是否连接时捕获EOF 需要'phpmailerautoad.php'; $mail=新的PHPMailer; $mail->SMTPDebug=3;//启用详细调试输出 $mail->isSMTP();//将邮件程序设置为使用SMTP $mail->Host='myhost';//指定主SMTP服务器和备份SMTP服务器 $mail->SMTPAuth=true;//启用SMTP身份验证 $mail->Username='myusername';//SMTP用户名 $mail->Password='mypassword';//SMTP密码 $mail->SMTPSecure='tls';//启用TLS加密,也接受'ssl' $mail->Port=1060;//要连接到的TCP端口 $mail->setFrom('test@gmail.com","测试",; $mail->isHTML(正确);//将电子邮件格式设置为HTML $mail->addAddress('test@gmail.com'); // 添加收件人 对于($i=0;$iSubject=“测试批量电子邮件”。$i; $mail->Body=“这是电子邮件”。$i; 如果(!$mail->Send()) { $error\u message=“Mailer error:”.$mail->ErrorInfo; } } 回显$error_消息;_Php_Smtp_Phpmailer_Starttls - Fatal编程技术网 isHTML(正确);//将电子邮件格式设置为HTML $mail->addAddress('test@gmail.com'); // 添加收件人 对于($i=0;$iSubject=“测试批量电子邮件”。$i; $mail->Body=“这是电子邮件”。$i; 如果(!$mail->Send()) { $error\u message=“Mailer error:”.$mail->ErrorInfo; } } 回显$error_消息;,php,smtp,phpmailer,starttls,Php,Smtp,Phpmailer,Starttls" /> isHTML(正确);//将电子邮件格式设置为HTML $mail->addAddress('test@gmail.com'); // 添加收件人 对于($i=0;$iSubject=“测试批量电子邮件”。$i; $mail->Body=“这是电子邮件”。$i; 如果(!$mail->Send()) { $error\u message=“Mailer error:”.$mail->ErrorInfo; } } 回显$error_消息;,php,smtp,phpmailer,starttls,Php,Smtp,Phpmailer,Starttls" />

检查PHP编译器是否连接时捕获EOF 需要'phpmailerautoad.php'; $mail=新的PHPMailer; $mail->SMTPDebug=3;//启用详细调试输出 $mail->isSMTP();//将邮件程序设置为使用SMTP $mail->Host='myhost';//指定主SMTP服务器和备份SMTP服务器 $mail->SMTPAuth=true;//启用SMTP身份验证 $mail->Username='myusername';//SMTP用户名 $mail->Password='mypassword';//SMTP密码 $mail->SMTPSecure='tls';//启用TLS加密,也接受'ssl' $mail->Port=1060;//要连接到的TCP端口 $mail->setFrom('test@gmail.com","测试",; $mail->isHTML(正确);//将电子邮件格式设置为HTML $mail->addAddress('test@gmail.com'); // 添加收件人 对于($i=0;$iSubject=“测试批量电子邮件”。$i; $mail->Body=“这是电子邮件”。$i; 如果(!$mail->Send()) { $error\u message=“Mailer error:”.$mail->ErrorInfo; } } 回显$error_消息;

检查PHP编译器是否连接时捕获EOF 需要'phpmailerautoad.php'; $mail=新的PHPMailer; $mail->SMTPDebug=3;//启用详细调试输出 $mail->isSMTP();//将邮件程序设置为使用SMTP $mail->Host='myhost';//指定主SMTP服务器和备份SMTP服务器 $mail->SMTPAuth=true;//启用SMTP身份验证 $mail->Username='myusername';//SMTP用户名 $mail->Password='mypassword';//SMTP密码 $mail->SMTPSecure='tls';//启用TLS加密,也接受'ssl' $mail->Port=1060;//要连接到的TCP端口 $mail->setFrom('test@gmail.com","测试",; $mail->isHTML(正确);//将电子邮件格式设置为HTML $mail->addAddress('test@gmail.com'); // 添加收件人 对于($i=0;$iSubject=“测试批量电子邮件”。$i; $mail->Body=“这是电子邮件”。$i; 如果(!$mail->Send()) { $error\u message=“Mailer error:”.$mail->ErrorInfo; } } 回显$error_消息;,php,smtp,phpmailer,starttls,Php,Smtp,Phpmailer,Starttls,运行此代码时,会出现以下错误: 连接:打开2018-03-05 09:24:25服务器->客户端:2018-03-05 09:24:25 SMTP通知:检查是否连接时捕获EOF 2018-03-05 09:24:25连接:关闭2018-03-05 09:24:25 SMTP错误:无法连接到SMTP主机 如何修复此问题?您正在使用一个不寻常的端口号进行SMTP提交,因此请检查是否有适合您主机的端口号。使用SMTPSecure='tls'时,端口号通常为587 您在通过另一台主机发送邮件时设置了gm

运行此代码时,会出现以下错误:

连接:打开2018-03-05 09:24:25服务器->客户端:2018-03-05 09:24:25 SMTP通知:检查是否连接时捕获EOF 2018-03-05 09:24:25连接:关闭2018-03-05 09:24:25 SMTP错误:无法连接到SMTP主机


如何修复此问题?

您正在使用一个不寻常的端口号进行SMTP提交,因此请检查是否有适合您主机的端口号。使用
SMTPSecure='tls'
时,端口号通常为587

您在通过另一台主机发送邮件时设置了gmail发件人地址;这将导致您无法通过SPF检查,您的邮件将被阻止或被垃圾邮件过滤


如果要发送到列表,请遵循-您的代码包含一些错误,可能会导致重复消息。

事实上,我不是通过gmail发件人地址发送,而是从同一主机发送。我使用的端口是正确的。我需要使用StartTLS。我使用的是旧版本的PHPmailer,因为我不知道如何使用它这是最新的版本,我不知道是什么作曲家和那些东西。嗯,你使用的是gmail发件人地址:
$mail->setFrom(
)test@gmail.com","测试")
。你是来学习的,对吗?那就去吧,或者,按照PHPMailer自述中的安装说明去做,它告诉你如何在没有composer的情况下使用最新版本。我写了这封电子邮件作为一个例子,我真的在使用另一封不是来自gmail的电子邮件。我想知道composer是如何工作的,以及如何使用它。这里有一个惊人的t我在上一篇评论中提到一个链接,你可以试着点击它。是的,下载了它,但对我来说仍然像盲文--
    require 'PHPMailerAutoload.php';

    $mail = new PHPMailer;
    $mail->SMTPDebug = 3;                               // Enable verbose debug output
    $mail->isSMTP();                                      // Set mailer to use SMTP
    $mail->Host = 'myhost';  // Specify main and backup SMTP servers
    $mail->SMTPAuth = true;                               // Enable SMTP authentication
    $mail->Username = 'myusername';                 // SMTP username
    $mail->Password = 'mypassword';                           // SMTP password
    $mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
    $mail->Port = 1060;                                    // TCP port to connect to
    $mail->setFrom('test@gmail.com', 'test');
    $mail->isHTML(true); // Set email format to HTML


    $mail->addAddress('test@gmail.com');    // Add a recipient  

    for($i=0;$i<1;$i++){
      $mail->Subject    = "test bulk email ".$i;
      $mail->Body       = "this is email ".$i;


      if(!$mail->Send()) 
      {
          $error_message = "Mailer Error: " . $mail->ErrorInfo;
      }
}

echo $error_message;