Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. function sendMail($subject, $body, $to) {
  2. $mail = new PHPMailer;
  3. $mail->isSMTP();
  4. $mail->Host = 'smtp.gmail.com';
  5. $mail->Port = 587;
  6. $mail->SMTPAuth = true;
  7. $mail->Username = 'ted314089@gmail.com';
  8. $mail->Password = 'tilt314fry089';
  9. $mail->SMTPSecure = 'ssl';
  10. $mail->CharSet = 'UTF-8';
  11. $mail->SMTPDebug = true;
  12.  
  13. $mail->From = "donotreply@trainbooking.com";
  14. $mail->FromName = "Train Booking";
  15. $mail->addAddress($to);
  16.  
  17. $mail->WordWrap = 50;
  18.  
  19. $mail->isHTML(true);
  20.  
  21. $mail->Subject = $subject;
  22. $mail->Body = $body;
  23.  
  24. if (!$mail->Send()) {
  25. throw new Exception($mail->ErrorInfo);
  26. }
  27.  
  28. if(!$mail->send()) {
  29. return false;
  30. } else {
  31. return true;
  32. }
  33. }
  34.  
  35.  
  36.  
  37. $to = $post->email;
  38. $subject = "Verify Account";
  39.  
  40. $message = "
  41. Dear Customer,
  42.  
  43. Thank you for taking the time to create an account in Train Booking. <br>
  44. You are now just one step away from creating your account.
  45.  
  46. You can verify your account by clicking this link <br>
  47. ".root_url."/configuration.php?key=".$hash."&request=verify_account
  48.  
  49. <br><br><br><br>
  50. <strong>NOTE:</strong> Do not respond to this email, it does not accept incoming emails!
  51. ";
  52.  
  53. $retval = sendMail($subject, $message, $to);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement