Advertisement
Guest User

Untitled

a guest
Mar 4th, 2019
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. use PHPMailerPHPMailerPHPMailer;
  5.  
  6.  
  7. use PHPMailerPHPMailerException;
  8.  
  9. require '../PHPMailer/src/SMTP.php';
  10. $mail = new PHPMailer;
  11.  
  12. //Enable SMTP debugging.
  13. $mail->SMTPDebug = 2;
  14. //Set PHPMailer to use SMTP.
  15. $mail->isSMTP();
  16. $mail->SMTPOptions = array(
  17. 'ssl' => array(
  18. 'verify_peer' => false,
  19. 'verify_peer_name' => false,
  20. 'allow_self_signed' => true
  21. )
  22. );
  23.  
  24. //Set SMTP host name
  25. $mail->Host = "smtp.gmail.com";
  26. //Set this to true if SMTP host requires authentication to send email
  27. $mail->SMTPAuth = true;
  28. //Provide username and password
  29. $mail->Username = "myusername@gmail.com";
  30. $mail->Password = "myemailpassword";
  31. //If SMTP requires TLS encryption then set it
  32. $mail->SMTPSecure = "tls";
  33. //Set TCP port to connect to
  34. $mail->Port = 587;
  35.  
  36. $mail->From = "myemail";
  37. $mail->FromName = "myname";
  38.  
  39. $mail->addAddress($email);
  40.  
  41. $mail->isHTML(true);
  42. $mail->CharSet = 'UTF-8';
  43.  
  44. $mail->Subject = "ACTIVATE YOUR ACCOUNT";
  45. $search = array('[sponsor]', '[email]', '[uid]', '[code]', '[username]', '[phone]', '[password]', '[bankname]', '[accname]', '[accno]');
  46. $replace = array($sponsor, $email, $uid, $code, $username, $phone, $_POST['password'], $bankname, $accname, $accno);
  47. $mail->Body = str_replace($search, $replace, file_get_contents('../Emails/registeremail.html'));
  48.  
  49. if(!$mail->send())
  50. {
  51. //add support link later
  52. $_SESSION['sign_msg']= "Something Went Wrong, Please contact Support";
  53. header('location:signup.php');
  54. }
  55. else
  56. {
  57.  
  58. $_SESSION['sign_msg'] = "Verification link has been sent to your email. &nbsp; &nbsp; &#9745; <br>
  59. Click on the link to verify your account";
  60. header('location:signup.php');
  61. }
  62. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement