【问题标题】:PHPMailer echo's from successful sent emailPHPMailer 从成功发送的电子邮件中回显
【发布时间】:2010-06-16 15:18:16
【问题描述】:

您好,我终于让 PHPMailer 与 Google 合作,但现在我发现在发送消息后我正在将这个输出显示到屏幕上。

SMTP -> FROM SERVER:220 mx.google.com ESMTP f34sm21891943qco.35
SMTP -> FROM SERVER: 250-mx.google.com at your service, [76.28.109.170] 250-SIZE 35651584 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:250 2.1.0 OK f34sm21891943qco.35
SMTP -> FROM SERVER:250 2.1.5 OK f34sm21891943qco.35
SMTP -> FROM SERVER:354 Go ahead f34sm21891943qco.35
SMTP -> FROM SERVER:250 2.0.0 OK 1276700936 f34sm21891943qco.35 

我想知道是否有任何方法可以删除此输出以使用户看不到它?

【问题讨论】:

    标签: php phpmailer


    【解决方案1】:

    $phpmailer->SMTPDebug 属性设置为0,您可能将其留在调试状态(至少,我检测到'finally' 已经完成了一些工作)。 http://phpmailer.worxware.com/index.php?pg=properties

    【讨论】:

      【解决方案2】:

      <?php
      
      	require("PHPMailer/PHPMailerAutoload.php");
      
      $mail = new PHPMailer;
      
      //Enable SMTP debugging. 3 disable=0
      $mail->SMTPDebug = 0;                               
      
      //Set PHPMailer to use SMTP.
      $mail->isSMTP();            
      
      //Set SMTP host name                          
      $mail->Host = "smtp.gmail.com";//or your domain
      
      //Set this to true if SMTP host requires authentication to send email
      $mail->SMTPAuth = true;                          
      
      //Provide username and password     
      $mail->Username = "your email";                 
      $mail->Password = "your email password";                           
      //If SMTP requires TLS encryption then set it
      $mail->SMTPSecure = "tls";                           
      //Set TCP port to connect to 
      $mail->Port = 587;                                   
      
      $mail->From = "your email";
      $mail->FromName = "your name";
      
      $mail->addAddress($userMail, $uname);
      
      $mail->isHTML(true);
      
      $mail->Subject = $subject;
      $mail->Body = $message;
      //$mail->AltBody = "This is the plain text version of the email content";
      
      // you can also comment the echos here out
      if(!$mail->send()) 
      {
          echo "Mailer Error: " . $mail->ErrorInfo;
      } 
      else 
      {
          echo "Message has been sent successfully";
      }
      
      ?>

      enter code here在第 8 行检查此图像。 您还可以注释掉 if(!$mail->send()){ } else{} 块

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-06-01
        • 2017-08-25
        • 2013-10-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-22
        • 1970-01-01
        相关资源
        最近更新 更多