Advertisement
Guest User

Untitled

a guest
Jan 10th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. <?php
  2. require_once "vendor/autoload.php";
  3.  
  4. $mail = new PHPMailer(); // create a new object
  5. $mail->IsSMTP(); // enable SMTP
  6. $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  7. $mail->SMTPAuth = true; // authentication enabled
  8. $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
  9. $mail->Host = "smtp.gmail.com";
  10. $mail->Port = 465; // or 587
  11. $mail->IsHTML(true);
  12. $mail->Username = "****";
  13. $mail->Password = "****";
  14. $mail->SetFrom("ramdhanrizki11@gmail.com");
  15. $mail->Subject = "Testing Kirim Email";
  16. $mail->Body = "Selamat datang";
  17. $mail->AddAddress("ramdhanrizki11@hotmail.com");
  18.  
  19. if(!$mail->Send()) {
  20. echo "Mailer Error: " . $mail->ErrorInfo;
  21. } else {
  22. echo "Message has been sent";
  23. }
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement