Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. <?php
  2. require_once('phpmailer/PHPMailerAutoload.php');
  3. include('config.php');
  4.  
  5. $mail = new PHPMailer;
  6.  
  7. $mail->CharSet = 'utf-8';
  8. $mail->isSMTP();
  9. $mail->Host = 'smtp.mail.ru';
  10. $mail->SMTPAuth = true;
  11. $mail->Username = 'test@mail';
  12. $mail->Password = 'password for email';
  13. $mail->SMTPSecure = 'ssl';
  14. $mail->Port = 465;
  15. $mail->setFrom('test2@mail');
  16. $mail->addAddress('test@mail'); // Кому будет уходить письмо
  17. $mail->isHTML(true); // Set email format to HTML
  18.  
  19. $mail->Subject = 'Заявка с тестового сайта';
  20.  
  21. $result=mysqli_query($mysqli,"select * from users where id=$id");
  22.  
  23. $mail->Body = '<table>';
  24. $mail->Body .= '<tr>';
  25. $mail->Body .= '<th>Model</th>';
  26. $mail->Body .= '<th>Issue</th>';
  27. $mail->Body .= '<th>Email</th>';
  28. $mail->Body .= '<th>Comment</th>';
  29. $mail->Body .= '<tr>';
  30. while($res = mysqli_fetch_array($result)){
  31. $mail->Body .= '<tr>';
  32. $mail->Body .= '<td>' . $res["name"] . '</td>';
  33. $mail->Body .= '<td>' . $res["age"] . '</td>';
  34. $mail->Body .= '<td>' . $res["email"] . '</td>';
  35. $mail->Body .= "<td>" . $res["comment"] . '</td>';
  36. $mail->Body .= '</tr>';
  37. }
  38. $mail->Body .= '</table>';
  39.  
  40. $mail->AltBody = '';
  41.  
  42. if(!$mail->send()) {
  43. echo 'Error';
  44. } else {
  45. header('location: index.php');
  46. }
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement