Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. <?php
  2.  
  3. // Import PHPMailer classes into the global namespace
  4. // These must be at the top of your script, not inside a function
  5. use PHPMailerPHPMailerPHPMailer;
  6. use PHPMailerPHPMailerException;
  7.  
  8. //Load composer's autoloader
  9. require 'PHPMailer/PHPMailer.php';
  10. require 'PHPMailer/SMTP.php';
  11. require 'PHPMailer/Exception.php';
  12.  
  13. $mail = new PHPMailer(true);
  14. try {
  15. //Server settings
  16. $mail->SMTPDebug = 2;
  17. $mail->isSMTP();
  18. $mail->Host = 'smtp.dominiodahostnet.com.br';
  19. $mail->SMTPAuth = true;
  20. $mail->Username = 'usuario=dominiodahostnet.com.br';
  21. // SMTP username
  22. $mail->Password = '****';
  23. //$mail->SMTPSecure = 'tls';
  24. $mail->Port = 587;
  25.  
  26. //Recipients
  27. $mail->setFrom('from@dominiodahostnet.com.br', 'Mailer');
  28. $mail->addAddress('address@dominiodahostnet.com.br', 'Joe User');
  29. //$mail->addAddress('ellen@example.com'); l
  30. //$mail->addReplyTo('info@example.com', 'Information');
  31. //$mail->addCC('cc@example.com');
  32. //$mail->addBCC('bcc@example.com');
  33.  
  34. //Attachments
  35. //$mail->addAttachment('/var/tmp/file.tar.gz');
  36. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg');
  37. //Content
  38. $mail->isHTML(true);
  39. $mail->Subject = 'Here is the subject';
  40. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  41. $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
  42.  
  43. $mail->send();
  44. echo 'Message has been sent';
  45. } catch (Exception $e) {
  46. echo 'Message could not be sent.';
  47. echo 'Mailer Error: ' . $mail->ErrorInfo;
  48. }
  49.  
  50. 2017-09-20 17:58:23 SERVER -> CLIENT: 220 smtpq.f1.k8.com.br ESMTP Postfix
  51. 2017-09-20 17:58:23 CLIENT -> SERVER: EHLO www.dominiodahostnet.com.br
  52. 2017-09-20 17:58:23 SERVER -> CLIENT: 250-smtpq.f1.k8.com.br250-PIPELINING250-SIZE 33554432250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
  53. 2017-09-20 17:58:23 CLIENT -> SERVER: STARTTLS
  54. 2017-09-20 17:58:23 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
  55. SMTP Error: Could not connect to SMTP host.
  56. 2017-09-20 17:58:23 CLIENT -> SERVER: QUIT
  57. 2017-09-20 17:58:23 SERVER -> CLIENT:
  58. 2017-09-20 17:58:23 SMTP ERROR: QUIT command failed:
  59. SMTP Error: Could not connect to SMTP host.
  60. Message could not be sent.Mailer Error: SMTP Error: Could not connect to SMTP host.
  61.  
  62. $mail->SMTPSecure = 'tls';
  63.  
  64. $mail->SMTPSecure = 'ssl';
  65.  
  66. ;extension=php_openssl.dll
  67.  
  68. ;extension=openssl.so
  69.  
  70. $mail->Username = 'usuario=dominiodahostnet.com.br';
  71.  
  72. $mail->Username = 'usuario@dominiodahostnet.com.br';
  73.  
  74. $mail->Username = 'usuario';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement