Advertisement
Guest User

Untitled

a guest
Apr 10th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. $bdd = new PDO('mysql:host=localhost;dbname=reportin', '******', '******');
  2.  
  3. include("connexion.php");
  4. require 'PHPMailerAutoload.php';
  5.  
  6. $sql= $bdd->query('SELECT count(id) as id from incident where retour="0" AND
  7. atelier IN("BC1","Four 1","Refoidisseur 1","Charbon A","Charbon B","Comm
  8. Charbon")');
  9. $data = $sql->fetch();
  10.  
  11. $mail = new PHPMailer;
  12.  
  13. $mail->SMTPDebug = 3;
  14.  
  15. $mail->isSMTP();
  16. $mail->Host = '******';
  17. $mail->SMTPAuth = true;
  18. $mail->Username = '******';
  19. $mail->Password = '*******';
  20. $mail->SMTPSecure = 'tls';
  21. $mail->Port = 587;
  22. $mail->setFrom('******');
  23. $mail->addAddress('******', 'name');
  24.  
  25. $mail->Subject = ' valider';
  26. $mail->Body = "
  27. <table>
  28. <thead>
  29. <tr>
  30.  
  31. <th> Destinataire |</th>
  32. <th> Atelier |</th>
  33. <th> Anomalie
  34. </th>
  35.  
  36. </tr>
  37. </thead>
  38. ";
  39.  
  40. foreach($data as $raw) {
  41. $destinataire=$raw['destinataire'];
  42. $atelier=$raw['atelier'];
  43. $anomalie=$raw['anomalie'];
  44.  
  45.  
  46.  
  47.  
  48. $mail->Body .="
  49. <tr>
  50.  
  51.  
  52. <td> ".$destinataire."</td>
  53. <td> ".$atelier." </td>
  54. <td> ".$anomalie." </td>
  55.  
  56. </tr>
  57. </table>
  58.  
  59. @endforeach
  60.  
  61. ";
  62. }
  63. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  64.  
  65.  
  66. if(!$mail->send()) {
  67. echo 'Message could not be sent.';
  68. echo 'Mailer Error : ' . $mail->ErrorInfo;
  69. } else {
  70. echo 'Message has been sent';
  71. }
  72.  
  73. Warning: Illegal string offset 'destinataire' in
  74. /home/reporting/public_html/bsk/sendemail/sendEmail.php on line 41
  75.  
  76. Warning: Illegal string offset 'atelier' in
  77. /home/reporting/public_html/bsk/sendemail/sendEmail.php on line 42
  78.  
  79. Warning: Illegal string offset 'anomalie' in
  80. /home/reporting/public_html/bsk/sendemail/sendEmail.php on line 43
  81.  
  82. Warning: Illegal string offset 'destinataire' in
  83. /home/reporting/public_html/bsk/sendemail/sendEmail.php on line 41
  84.  
  85. Warning: Illegal string offset 'atelier' in
  86. /home/reporting/public_html/bsk/sendemail/sendEmail.php on line 42
  87.  
  88. Warning: Illegal string offset 'anomalie' in
  89. /home/reporting/public_html/bsk/sendemail/sendEmail.php on line 43
  90. Message has been sent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement