Guest User

Untitled

a guest
Mar 22nd, 2018
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.11 KB | None | 0 0
  1. <?php
  2. use PHPMailerPHPMailerPHPMailer;
  3. date_default_timezone_set('Etc/UTC');
  4. require 'vendor/autoload.php';
  5. //Create a new PHPMailer instance
  6. //$mailer = new PHPMailer(true);
  7. $mail = new PHPMailer();
  8. //Set who the message is to be sent from
  9. $mail->isSMTP();
  10. //Enable SMTP debugging
  11. // 0 = off (for production use)
  12. // 1 = client messages
  13. // 2 = client and server messages
  14. $mail->SMTPDebug = 2;
  15. //Set the hostname of the mail server
  16. $mail->Host = 'xxxxxxxxxxxxxx';
  17. //Set the SMTP port number - likely to be 25, 465 or 587
  18. $mail->Port = 587;
  19. $mail->SMTPSecure = "ssl";
  20. //Whether to use SMTP authentication
  21. $mail->SMTPAuth = true;
  22. //Username to use for SMTP authentication
  23. $mail->Username = 'xxxxxxxxxxxxxxxxx';
  24. //Password to use for SMTP authentication
  25. $mail->Password = 'xxxxxxxxxxxxxxxxx';
  26. $mail->setFrom('xxxxxxxxxxxxxxxxx', 'xxxxxxxxx');
  27. //Set an alternative reply-to address
  28. //$mail->addReplyTo('replyto@example.com', 'First Last');
  29. //Set who the message is to be sent to
  30.  
  31. $mail->AddAddress("xxxxxxxxxxxxx");
  32. //Set the subject line
  33. //$mail->Subject = 'PHPMailer SMTP test';
  34. //Read an HTML message body from an external file, convert referenced images to embedded,
  35. //convert HTML into a basic plain-text alternative body
  36. //$mail->Body = 'Test';
  37. $mail->msgHTML("test");
  38. //Replace the plain text body with one created manually
  39. //$mail->AltBody = 'This is a plain-text message body';
  40. //Attach an image file
  41. //$mail->addAttachment('images/phpmailer_mini.png');
  42. //send the message, check for errors
  43.  
  44. if (!$mail->send()) {
  45. echo "Mailer Error: " . $mail->ErrorInfo;
  46. } else {
  47. echo "Message sent!";
  48. }
  49. ?>
Add Comment
Please, Sign In to add comment