Guest User

Untitled

a guest
Oct 28th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. function mailit()
  2. {
  3. $rand=rand(100000,999999);
  4. $user=$_SESSION['user'];
  5.  
  6. $sql=mysqli_query($db,"UPDATE `patient_login` SET `otp`='$rand' WHERE `patient_id`='1'");
  7.  
  8. $mail = new PHPMailer;
  9.  
  10. $mail->isSMTP(); // Set mailer to use SMTP
  11. $mail->Host = ''; // Specify main and backup SMTP servers
  12. $mail->SMTPAuth = true; // Enable SMTP authentication
  13. $mail->Username = 'myusername '; // SMTP username
  14. $mail->Password = 'mypassword'; // SMTP password
  15. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  16. $mail->Port = 587 ; // TCP port to connect to
  17.  
  18. $mail->setFrom('dont_reply_back@example.xyz');
  19. $mail->addAddress('$row'); // Add a recipient
  20. $mail->addReplyTo('dont_reply_back@example.xyz');
  21.  
  22.  
  23. $mail->isHTML(true); // Set email format to HTML
  24. $mail->Subject = 'THis is your OTP';
  25. $mail->Body = 'Your otp is '.$rand;
  26.  
  27. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  28.  
  29. if(!$mail->send()) {
  30. echo 'Message could not be sent.';
  31. echo 'Mailer Error: ' . $mail->ErrorInfo;
  32. }
  33. }
  34.  
  35. $mailadd=mysqli_query($db,"SELECT `doctor_email` FROM `doctor_login` WHERE `doctor_id`='1'");
  36. $row = mysqli_fetch_array($mailadd,MYSQLI_ASSOC);
  37. echo $row['doctor_email'];
  38. $row2=$rowa['doctor_email'];
  39. echo $row2;
Add Comment
Please, Sign In to add comment