2017-05-29 51 views
-1
while ($apa = mysql_fetch_array($query)){ 
    $username = print($apa['username']); 
    $pass = print(md5(md5($apa['password']))); 

    require '../phpmailer/PHPMailerAutoload.php'; 
     require '../phpmailer/class.phpmailer.php'; 

     $mail = new PHPMailer; 
     //$mail->SMTPDebug = 3;        // Enable verbose debug output 

     $mail->isSMTP();          // Set mailer to use SMTP 
      $mail->Host = 'mail.royaleducation.web.id'; // Specify main and backup SMTP servers 
      $mail->SMTPAuth = true;        // Enable SMTP authentication 
      $mail->Username = 'xxxxxx';     // SMTP username 
      $mail->Password = 'xxxxxx';       // SMTP password 
      $mail->SMTPSecure = 'ssl';       // Enable TLS encryption, `ssl` also accepted 
      $mail->Port = 465;         // TCP port to connect to 

     $mail->setFrom($email,$name); 
     $mail->addAddress($email);  // Add a recipient 
     $mail->addReplyTo($email); 
     $mail->isHTML(true);         // Set email format to HTML> 
     $mail->msgHTML(

      "<center><h1>Your data</h1></center><br><br> 
      username =".$username."<br> 
      password =".$password 



     ); 

=後$用戶名$密碼不會出現.. 我錯了把打印後$ USERNAME$密碼? 或者有另一種方法可以打印出phpmailer中的值?因爲如果如果你使用print功能i型回聲$ MAIL-> msgHTML內,其收到錯誤回聲或打印在PHP

+0

你不是真的在一封電子郵件中發送用戶名和密碼在明文,是嗎?當然,密碼是* double * -'md5''d,但是'md5'也被破壞了。你爲什麼這樣做呢? – Bytewave

+0

MD5沒有壞,我把它加倍..我想測試它,但如果我忘記了密碼,我必須從數據庫中獲得用戶名和密碼,並再次發送給我的電子郵件..問題是,我得到了我的用戶名和密碼的價值,但它不會出現在我的電子郵件中。 –

+1

'md5'在安全性方面*非常*破碎。您應該*永遠不要*將它用於新項目,並且應該將舊項目從中移出。即使你做了兩次,它仍然是一個破碎的算法。 – Bytewave

回答

1

,參數顯示在輸出和print始終返回1,這樣你就可以不分配使用值。

如果你有問題$mail->msgHTML功能,您可以如下使用$mail->Body

while ($apa = mysql_fetch_array($query)){ 
    $username = $apa['username']; 
    $pass = md5(md5($apa['password'])); 

    require '../phpmailer/PHPMailerAutoload.php'; 
     require '../phpmailer/class.phpmailer.php'; 

     $mail = new PHPMailer; 
     //$mail->SMTPDebug = 3;        // Enable verbose debug output 

     $mail->isSMTP();          // Set mailer to use SMTP 
      $mail->Host = 'mail.royaleducation.web.id'; // Specify main and backup SMTP servers 
      $mail->SMTPAuth = true;        // Enable SMTP authentication 
      $mail->Username = 'idxxxx';     // SMTP username 
      $mail->Password = 'xxxxx';       // SMTP password 
      $mail->SMTPSecure = 'ssl';       // Enable TLS encryption, `ssl` also accepted 
      $mail->Port = 465;         // TCP port to connect to 

     $mail->setFrom($email,$name); 
     $mail->addAddress($email);  // Add a recipient 
     $mail->addReplyTo($email); 
     $mail->isHTML(true);         // Set email format to HTML> 
     $mail->Body ="<center><h1>Your data</h1></center><br><br>username =".$username."<br>password =".$password; 
+0

所以我無法使用打印或回聲後=? –

+0

如果使用print,你的變量總是1。 –

+0

yaaa我得到那1結果。所以我怎麼可以在$ mail-> msgHTML中回顯變量? –