Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <?php
  2. // Import PHPMailer classes into the global namespace
  3. // These must be at the top of your script, not inside a function
  4. use PHPMailer\PHPMailer\PHPMailer;
  5. use PHPMailer\PHPMailer\Exception;
  6.  
  7. require 'PHPMailer/src/Exception.php';
  8. require 'PHPMailer/src/PHPMailer.php';
  9. require 'PHPMailer/src/SMTP.php';
  10.  
  11. $mail = new PHPMailer(true); // Passing `true` enables exceptions
  12. try {
  13. //Server settings
  14.  
  15. $mail->isSMTP(''); // Set mailer to use SMTP
  16. $mail->Host = 'server saya * maav saya hapus buat contoh saya'; // Specify main and backup SMTP servers
  17. $mail->SMTPAuth = true; // Enable SMTP authentication
  18. $mail->Username = 'user saya'; // SMTP username
  19. $mail->Password = 'pass saya'; // SMTP password
  20. $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
  21. $mail->Port = 225 ; // TCP port to connect to
  22.  
  23. //Recipients
  24. $mail->setFrom('saya@mail.com');
  25. $mail->addAddress('kamu@mail.com'); // Add a recipient
  26.  
  27.  
  28.  
  29.  
  30. //Content
  31. $mail->isHTML(true); // Set email format to HTML
  32. $mail->Subject = 'Test Mail CAD EDP Tracking';
  33. $mail->Body = 'Laporan Peminjaman Cad EDP';
  34.  
  35. $mail->send();
  36. echo 'Message has been sent';
  37. } catch (Exception $e) {
  38. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement