简体   繁体   中英

Hide smtp process message in php, showing up on page

smtp process message keep showing on my page, i want to know how to hide it show it doesnt show when i use $mail->Send()).

SMTP -> FROM SERVER:220 smtp.gmail.com ESMTP b45sm276471eda.15 - gsmtp 
SMTP -> FROM SERVER: 250-smtp.gmail.com at your service, [91.73.223.200] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 
SMTP -> FROM SERVER:220 2.0.0 Ready to start TLS 
SMTP -> FROM SERVER: 250-smtp.gmail.com at your service, [91.73.223.200] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 
SMTP -> FROM SERVER:250 2.1.0 OK b45sm276471eda.15 - gsmtp 
SMTP -> FROM SERVER:250 2.1.5 OK b45sm276471eda.15 - gsmtp 
SMTP -> FROM SERVER:354 Go ahead b45sm276471eda.15 - gsmtp 
SMTP -> FROM SERVER:250 2.0.0 OK 1502865741 b45sm276471eda.15 - gsmtp 
SMTP -> FROM SERVER:221 2.0.0 closing connection b45sm276471eda.15 - gsmtp 
    SMTP -> FROM SERVER:220 smtp.gmail.com ESMTP b45sm276471eda.15 - gsmtp 
    SMTP -> FROM SERVER: 250-smtp.gmail.com at your service, [91.73.223.200] 250-SIZE 35882577 250-8BITMIME 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 
    SMTP -> FROM SERVER:220 2.0.0 Ready to start TLS 
    SMTP -> FROM SERVER: 250-smtp.gmail.com at your service, [91.73.223.200] 250-SIZE 35882577 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-CHUNKING 250 SMTPUTF8 
    SMTP -> FROM SERVER:250 2.1.0 OK b45sm276471eda.15 - gsmtp 
    SMTP -> FROM SERVER:250 2.1.5 OK b45sm276471eda.15 - gsmtp 
    SMTP -> FROM SERVER:354 Go ahead b45sm276471eda.15 - gsmtp 
    SMTP -> FROM SERVER:250 2.0.0 OK 1502865741 b45sm276471eda.15 - gsmtp 
    SMTP -> FROM SERVER:221 2.0.0 closing connection b45sm276471eda.15 - gsmtp 

Here is my code

$msg_res = mysqli_query($link, $sql_msg);
// $row_msg = mysqli_num_rows($msg_res);  

while ($row_res = mysqli_fetch_assoc($msg_res))  {
    enter code here
    $ans = $row_res['response'];
    $qn_code1 = $row_res['qn_code'];
    $qn_sql = "select qn_txt from survey_questions where qn_code = '$qn_code1';";
    $qn_res = mysqli_query($link,$qn_sql);
    $qn_results = mysqli_fetch_assoc($qn_res);
    $qn_txt = $qn_results['qn_txt'];
    $message1.= $qn_txt.":".$ans."<br>";
}



$subject = "$so_num Survey Results - Partner Requested Prompt Feedback";
$message = "<p>Please find below the survey questions and the responses from partner &nbsp;&emsp;     :      &emsp;&nbsp;   </p>  $message1";

$mail = new PHPMailer();
$mail->IsSMTP(); // set mailer to use SMTP
$mail->SMTPDebug = 2;
$mail->SingleTo = true; //will send mail to each email address individually

$mail->From = "unhrdtestmail@gmail.com";
$mail->FromName = "UNHRD Dashboard";
$mail->Host = "smtp.gmail.com"; // specify smtp server
$mail->SMTPSecure = "tls"; // Used instead of SSL when only POP mail is selected
$mail->Port = 587; // Used instead of 587/465 when only POP mail is selected
$mail->SMTPAuth = true;
$mail->Mailer = "smtp";
$mail->Username = "unhrdtestmail@gmail.com"; // SMTP username
$mail->Password = "raina@unhrd"; // SMTP password
//$mail->AddAddress("bhagya.bose@wfp.org");/test
//$mail->AddAddress("renato.kuras@wfp.org");
//$mail->AddAddress("unhrd_cs_representatives@wfp.org");
$mail->AddAddress("abdullahimurtal4@gmail.com"); //test

$mail->IsHTML(true);
$mail->Subject =$subject;
$mail->Body =$message;


if ($mail->Send())
                        {
    echo "<div class='alert alert-fixed'>Message has been sent</div>";
}

else 
{
    echo "Message could not be sent.";
}
}

Your enabled debug information

From

$mail->SMTPDebug  = 2; // enables SMTP debug information (for testing)
                       // 1 = errors and messages
                       // 2 = messages only

to

   $mail->SMTPDebug  = 0;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM