Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.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
PHPMailer服务器消息_Php_Email_Phpmailer_Messages - Fatal编程技术网

PHPMailer服务器消息

PHPMailer服务器消息,php,email,phpmailer,messages,Php,Email,Phpmailer,Messages,我正在为PHPMailer使用php插件。其版本为PHPMailer_5.2.4。我已经测试了PhpMailer站点的示例代码 <?php require_once('PHPMailer_5.2.4/class.phpmailer.php'); //include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded $mail

我正在为PHPMailer使用php插件。其版本为PHPMailer_5.2.4。我已经测试了PhpMailer站点的示例代码

 <?php
require_once('PHPMailer_5.2.4/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded

$mail             = new PHPMailer();

//$body             = file_get_contents('contents.html');
//$body             = eregi_replace("[\]",'',$body);

$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host       = "mail.google.com"; // SMTP server
$mail->SMTPDebug  = 2;                     // enables SMTP debug information (for testing)
                                           // 1 = errors and messages
                                           // 2 = messages only
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "tls";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 587;                   // set the SMTP port for the GMAIL server
$mail->Username   = "myuser@gmail.com";  // GMAIL username
$mail->Password   = "mypass";            // GMAIL password

$mail->SetFrom('myuser@gmail.com', 'First Last');

$mail->Subject    = "FeedBack";

$mail->MsgHTML("helo hru ");

$address = "whomto@domainname.com";
$mail->AddAddress($address, "MYName");
$mail->Send();


//if(!$mail->Send()) {
  ////echo "Mailer Error: " . $mail->ErrorInfo;
//} 
//else {
  //echo "Message sent!";
//}

?>

执行完这段代码后,我得到以下输出。但邮件已在我的收件人邮箱成功接收。但我不想要下面的输出消息。我怎样才能纠正它

SMTP->来自服务器:220 mx.google.com ESMTP b3sm40861402pbu.38-gsmtp

SMTP->来自服务器:250-mx.google.com,为您服务,[ipAddress] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUS代码 250分块

SMTP->来自服务器:220 2.0.0准备启动TLS

SMTP->来自服务器:250-mx.google.com,为您服务,[ipAddress] 250-SIZE 35882577 250-8BITMIME 250-AUTH登录普通XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN 250-ENHANCEDSTATUSCODES 250分块

SMTP->来自服务器:250 2.1.0正常b3sm40861402pbu.38-gsmtp

SMTP->来自服务器:250 2.1.5正常b3sm40861402pbu.38-gsmtp

SMTP->来自服务器:354继续b3sm40861402pbu.38-gsmtp

SMTP->来自服务器:250 2.0.0正常1383737961 b3sm40861402pbu.38-gsmtp

SMTP->来自服务器:221 2.0.0正在关闭连接b3sm40861402pbu.38- gsmtp


只需删除这行代码:

$mail->SMTPDebug  = 2;

它将禁用调试输出。

这只是调试输出。将
$mail->SMTPDebug
设置为0

您的问题是
$mail->SMTPDebug

设置该值会告诉PHPMailer输出调试数据,这就是您看到的


删除该行,您将无法再获得输出。

+1因为您比我快。(尽管我要说的是删除该行;它默认为
0
,因此没有明确设置它的意义)