Advertisement
Guest User

Untitled

a guest
Aug 19th, 2016
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. include_once('phpmailer/PHPMailerAutoload.php');
  2. echo $_SERVER['DOCUMENT_ROOT'];
  3. function sendmail($body){
  4. //Create a new PHPMailer instance
  5. $mail = new PHPMailer;
  6. //Tell PHPMailer to use SMTP
  7. $mail->isSMTP();
  8. //Enable SMTP debugging
  9. // 0 = off (for production use)
  10. // 1 = client messages
  11. // 2 = client and server messages
  12. $mail->SMTPDebug = 2;
  13. //Ask for HTML-friendly debug output
  14. $mail->Debugoutput = 'html';
  15. //Set the hostname of the mail server
  16. $mail->Host = 'smtp.gmail.com';
  17. // use
  18. // $mail->Host = gethostbyname('smtp.gmail.com');
  19. // if your network does not support SMTP over IPv6
  20. //Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
  21. $mail->Port = 587;
  22. //Set the encryption system to use - ssl (deprecated) or tls
  23. $mail->SMTPSecure = 'tls';
  24. //Whether to use SMTP authentication
  25. $mail->SMTPAuth = true;
  26.  
  27. $mail->Username = 'mail@gmail.com'; // SMTP username
  28. $mail->Password = 'pass'; // SMTP password
  29.  
  30. $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
  31. // 1 = errors and messages
  32. // 2 = messages only
  33.  
  34. $mail->From = 'from@from.net';
  35. $mail->FromName = 'Site';
  36. $mail->AddAddress('to@yahoo.com', 'To'); // Add a recipient
  37.  
  38. $mail->IsHTML(true); // Set email format to HTML
  39.  
  40. $mail->Subject = 'Site: New unmapped teams found!';
  41. $mail->Body = $body;
  42. $mail->AltBody = $body;
  43.  
  44. if(!$mail->Send()) {
  45. echo 'Message could not be sent.';
  46. echo 'Mailer Error: ' . $mail->ErrorInfo;
  47. exit;
  48. }
  49.  
  50. echo 'Message has been sent';
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement