PHPMailer服务器消息

Smi*_*yne 0 php email messages phpmailer

我正在为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!";
//}

?>
Run Code Online (Sandbox Code Playgroud)

执行此代码后,我得到以下输出.但邮件已成功收到我的收件人邮件地址.但我不想要下面的输出消息.我怎样才能纠正它?

SMTP - > FROM SERVER:220 mx.google.com ESMTP b3sm40861402pbu.38 - gsmtp

SMTP - > FROM SERVER:250-mx.google.com为您服务,[ipAddress] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250 CHUNKING

SMTP - > FROM SERVER:220 2.0.0准备启动TLS

SMTP - > FROM SERVER:250-mx.google.com为您服务,[ipAddress] 250-SIZE 35882577 250-8BITMIME 250-AUTH登录平面XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN 250-ENHANCEDSTATUSCODES 250 CHUNKING

SMTP - > FROM SERVER:250 2.1.0 OK b3sm40861402pbu.38 - gsmtp

SMTP - > FROM SERVER:250 2.1.5 OK b3sm40861402pbu.38 - gsmtp

SMTP - > FROM SERVER:354继续b3sm40861402pbu.38 - gsmtp

SMTP - > FROM SERVER:250 2.0.0 OK 1383737961 b3sm40861402pbu.38 - gsmtp

SMTP - > FROM SERVER:221 2.0.0关闭连接b3sm40861402pbu.38 - gsmtp

小智 6

只需删除这行代码:

$mail->SMTPDebug  = 2;
Run Code Online (Sandbox Code Playgroud)

它将禁用调试输出.