Guest User

Untitled

a guest
Nov 8th, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. <?php
  2. function sendOTP($clientemail,$num) {
  3. require('phpmailer/class.phpmailer.php');
  4.  
  5.  
  6. $message_body = "One Time Password for PHP login authentication is:<br/><br/>" . $num;
  7.  
  8. $mail = new PHPMailer(); // create a new object
  9. $mail->IsSMTP(); // enable SMTP
  10. $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
  11. $mail->SMTPAuth = true; // authentication enabled
  12. $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
  13. $mail->Host = "smtp.gmail.com";
  14. $mail->Port = 465; // or 587
  15. $mail->IsHTML(true);
  16. $mail->Username = "Azad";
  17. $mail->Password = "mypass";
  18. $mail->SetFrom("myemail");
  19. $mail->Subject = "Test";
  20. $mail->Body = "hello";
  21. $mail->AddAddress("anotheremail");
  22.  
  23. if(!$mail->Send()){
  24. echo "Mailer Error: " . $mail->ErrorInfo;
  25. }
  26. else{
  27. echo "Message has been sent";
  28. }
  29.  
  30. }
  31. ?>
Add Comment
Please, Sign In to add comment