satizhsaa

Untitled

Dec 4th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.75 KB | None | 0 0
  1. <?php
  2. /**
  3.  * This example shows making an SMTP connection with authentication.
  4.  */
  5.  
  6. //SMTP needs accurate times, and the PHP time zone MUST be set
  7. //This should be done in your php.ini, but this is how to do it if you don't have access to that
  8. date_default_timezone_set('Etc/UTC');
  9.  
  10. require '../PHPMailerAutoload.php';
  11.  
  12. //Create a new PHPMailer instance
  13. $mail = new PHPMailer;
  14. //Tell PHPMailer to use SMTP
  15. $mail->isSMTP();
  16. //Enable SMTP debugging
  17. // 0 = off (for production use)
  18. // 1 = client messages
  19. // 2 = client and server messages
  20. $mail->SMTPDebug = 2;
  21. //Ask for HTML-friendly debug output
  22. $mail->Debugoutput = 'html';
  23. //Set the hostname of the mail server
  24. $mail->Host = "swoln.net";
  25. $mail->SMTPAuth = true;
  26.  
  27. $mail->Username = "info@swoln.net";
  28. $mail->Password = "*********";
  29. $mail->SMTPSecure = 'tls';  
  30. //$mail->SMTPSecure = false;
  31. //$mail->SMTPAutoTLS = false;
  32. //Set the SMTP port number - likely to be 25, 465 or 587
  33. $mail->Port = 587;
  34.  
  35. //Set who the message is to be sent from
  36. $mail->setFrom('info@swoln.net', 'swoln');
  37. //Set who the message is to be sent to
  38. $mail->addAddress('satizhsaa@gmail.com', 'satizh j');
  39. $mail->AddReplyTo('info@swoln.net','swoln');
  40. //Set the subject line
  41. //Read an HTML message body from an external file, convert referenced images to embedded,
  42. //convert HTML into a basic plain-text alternative body
  43. $mail->isHTML(true);
  44. $mail->Subject = 'Here is the subject';
  45. $mail->Body    = 'This is the HTML message body <b>in bold!</b>';
  46. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  47.  
  48. //Replace the plain text body with one created manually
  49.  
  50. //send the message, check for errors
  51. if (!$mail->send()) {
  52.     echo "Mailer Error: " . $mail->ErrorInfo;
  53. } else {
  54.     echo "Message sent!";
  55. }
Add Comment
Please, Sign In to add comment