Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. <?php
  2. use PHPMailer\PHPMailer\PHPMailer;
  3. use PHPMailer\PHPMailer\Exception;
  4.  
  5. /* Exception class. */
  6. require 'phpmailer/src/Exception.php';
  7.  
  8. /* The main PHPMailer class. */
  9. require 'phpmailer/src/PHPMailer.php';
  10.  
  11. /* SMTP class, needed if you want to use SMTP. */
  12. require 'phpmailer/src/SMTP.php';
  13.  
  14. $mail = new PHPMailer(true);
  15. /* ... */
  16. try {
  17. //Server settings
  18. $mail->SMTPDebug = 0; // Enable verbose debug output
  19. $mail->isSMTP(); // Send using SMTP
  20. $mail->Host = 'smtp.dpoczta.pl'; // Set the SMTP server to send through
  21. $mail->SMTPAuth = true; // Enable SMTP authentication
  22. $mail->Username = 'szymon@ideasem.pl'; // SMTP username
  23. $mail->Password = 'Szymon.RDB123!@#'; // SMTP password
  24. $mail->SMTPSecure = 'tls'; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` also accepted
  25. $mail->Port = 587; // TCP port to connect to
  26. $mail->CharSet = 'UTF-8';
  27.  
  28.  
  29. //Recipients
  30. $mail->setFrom('szymon@ideasem.pl', 'Formularz kontaktowy');
  31. $mail->addAddress('nk@rdbgroup.pl', 'Joe User'); // Add a recipient
  32.  
  33. // Content
  34.  
  35. $mail->isHTML(true);
  36. $mail->Subject = 'Szybka prośba o kontakt';
  37. $mail->Body = join('', array(
  38. "Nazwa firmy: ",
  39. $_POST['companyform'],
  40. "<br/>",
  41. "Imię i nazwisko: ",
  42. $_POST['nameform'],
  43. "<br/>",
  44. "Adres Email: ",
  45. $_POST['mailform'],
  46. "<br/>",
  47. "Numer telefonu: ",
  48. $_POST['phoneform'],
  49. "<br/>",
  50. "Wiadomość: ",
  51. $_POST['contentform'],
  52. ));
  53.  
  54. $mail->send();
  55. echo "<script>alert('Wiadomość została wysłana')</script>";
  56.  
  57. echo'<script>window.location.href="https://bpo2.you2.pl/mail-success.html";</script>';
  58. } catch (Exception $e) {
  59. echo "Wiadomość nie została wysłana. Powód: {$mail->ErrorInfo}";
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement