Advertisement
Guest User

Untitled

a guest
Jan 11th, 2018
1,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.57 KB | None | 0 0
  1. <?php
  2. // Import PHPMailer classes into the global namespace
  3. // These must be at the top of your script, not inside a function
  4. use PHPMailerPHPMailerPHPMailer;
  5. use PHPMailerPHPMailerException;
  6.  
  7.  
  8. // 'PHPMailer' here actually is the original folder 'PHPMailer-master'
  9. // from unpacking the downloaded file PHPMailer-master.zip
  10. require 'vendor/PHPMailer/src/Exception.php';
  11. require 'vendor/PHPMailer/src/PHPMailer.php';
  12. require 'vendor/PHPMailer/src/SMTP.php';
  13.  
  14. echo (extension_loaded('openssl')?'SSL loaded':'SSL not loaded')."n";
  15.  
  16. $mail = new PHPMailer(true); // Passing `true` enables exceptions
  17. try {
  18. //Server settings
  19. $mail->SMTPDebug = 2; // Enable verbose debug output
  20.  
  21. $mail->isSMTP();
  22. $mail->Host = 'smtp.kabelmail.de'; //smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
  23. $mail->SMTPAuth = true; // Enable SMTP authentication
  24. $mail->Username = 'myname@kabelmail.de'; // SMTP username
  25. $mail->Password = 'mypassword'; // SMTP password
  26. $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
  27. $mail->Port = 465; // TCP port to connect to
  28.  
  29. //Recipients
  30. $mail->setFrom('from@example.com', 'Mailer');
  31. $mail->addAddress('myname@kabelmail.de', 'myname'); // Add a recipient
  32. // $mail->addAddress('ellen@example.com'); // Name is optional
  33. $mail->addReplyTo('myname@web.de', 'Antwort');
  34. //$mail->addCC('cc@example.com');
  35. //$mail->addBCC('bcc@example.com');
  36.  
  37. //Attachments
  38. //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
  39. //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
  40.  
  41. //Content
  42. $mail->isHTML(true); // Set email format to HTML
  43. $mail->Subject = 'Here is the subject:localhost';
  44. $mail->Body = 'This is the HTML message body <b>in bold!</b>';
  45. $mail->AltBody = ' body in plain text for non-HTML mail lients';
  46.  
  47. $mail->send();
  48. echo 'Message has been sent';
  49. } catch (Exception $e) {
  50. echo 'Message could not be sent.';
  51. echo 'Mailer Error: ' . $mail->ErrorInfo;
  52. }
  53. ?>
  54.  
  55. [mail function]
  56. SMTP=smtp.kabelmail.de
  57. smtp_port=465
  58. sendmail_from = to@kabelmail.de
  59. sendmail_path ="C:xamppsendmailsendmail.exe"
  60. ;(I also tried sendmail_path = ""C:xamppsendmailsendmail.exe" -t" but without success.)
  61. mail.log="C:xamppphplogsphp_mail.log"
  62.  
  63. [sendmail]
  64. smtp_server=smtp.kabelmail.de
  65. smtp_port=465
  66. smtp_ssl=auto
  67. error_logfile=error.log
  68. debug_logfile=debug.log
  69. auth_username=myname@kabelmail.de
  70. auth_password=mypassword
  71.  
  72. SSL loaded 2018-01-11 12:06:10 SERVER -> CLIENT: 421 4.3.2 Too many open connections.
  73. 2018-01-11 12:06:10 CLIENT -> SERVER: EHLO localhost
  74. 2018-01-11 12:06:10 SERVER -> CLIENT:
  75. 2018-01-11 12:06:10 SMTP ERROR: EHLO command failed:
  76. 2018-01-11 12:06:10 SMTP NOTICE: EOF caught while checking if connected
  77. SMTP Error: Could not connect to SMTP host.
  78. SMTP Error: Could not connect to SMTP host.
  79. Message could not be sent.Mailer Error: SMTP Error: Could not connect to SMTP host.
  80.  
  81. [11-Jan-2018 13:09:32 Europe/Berlin] mail() on [C:xampphtdocstovendorPHPMailersrcPHPMailer.php:768]: To: "name" <myname@kabelmail.de> -- Headers: Date: Thu, 11 Jan 2018 13:09:32 +0100 From: Mailer <from@example.com> Reply-To: Antwort <myname@web.de> Message-ID: <VuAQ3BR022MQyNd3hKCoguqr50Ry9TPG4vIRL2ZmFg@localhost> X-Mailer: PHPMailer 6.0.3 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="b1_VuAQ3BR022MQyNd3hKCoguqr50Ry9TPG4vIRL2ZmFg" Content-Transfer-Encoding: 8bit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement