Advertisement
teguhsugiono891208

error send email

Sep 13th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. <?Php
  2. require("PHPMailer_5.2.4/class.smtp.php");
  3. require("PHPMailer_5.2.4/class.phpmailer.php");
  4.  
  5.  
  6. $mail = new PHPMailer();
  7. $mail->IsSMTP(); // telling the class to use SMTP
  8. $mail->SMTPDebug = 1;
  9. $mail->SMTPAuth = TRUE;
  10. $mail->SMTPSecure = "SSL";
  11. $mail->Host = "smtp.gmail.com"; // SMTP server
  12. $mail->Port = "465";
  13. $mail->IsHTML(true) ;
  14. $mail->Username = "dia.ajah@gmail.com";
  15. $mail->Password = "rahasia";
  16. $mail->setFrom("dia.ajah@gmail.com");
  17.  
  18. $subject = "Laporan Absen";
  19. $mail->Subject = $subject;
  20.  
  21. $message = 'Terlampir Adalah Data Laporan Absen '.date('d-M-Y H:i');
  22. $message .= '<br><br><br>' ;
  23. $message .= 'Best Regards,<br>';
  24. $message .= 'Absensi Sistem <br>';
  25. $message .= '(Data ini diproses dan dikirim oleh system secara otomatis)';
  26.  
  27. $mail->Body = $message;
  28.  
  29. $to = "aku.ajah@balrich.co.id";
  30. $mail->AddAddress($to);
  31. //$mail->Send();
  32.  
  33. if(!$mail->Send()) {
  34. echo "Mailer Error: " . $mail->ErrorInfo;
  35. } else {
  36. echo "Message sent!";
  37. }
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement