Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Import PHPMailer classes into the global namespace
- // These must be at the top of your script, not inside a function
- use PHPMailerPHPMailerPHPMailer;
- use PHPMailerPHPMailerException;
- // 'PHPMailer' here actually is the original folder 'PHPMailer-master'
- // from unpacking the downloaded file PHPMailer-master.zip
- require 'vendor/PHPMailer/src/Exception.php';
- require 'vendor/PHPMailer/src/PHPMailer.php';
- require 'vendor/PHPMailer/src/SMTP.php';
- echo (extension_loaded('openssl')?'SSL loaded':'SSL not loaded')."n";
- $mail = new PHPMailer(true); // Passing `true` enables exceptions
- try {
- //Server settings
- $mail->SMTPDebug = 2; // Enable verbose debug output
- $mail->isSMTP();
- $mail->Host = 'smtp.kabelmail.de'; //smtp1.example.com;smtp2.example.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'myname@kabelmail.de'; // SMTP username
- $mail->Password = 'mypassword'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 465; // TCP port to connect to
- //Recipients
- $mail->setFrom('from@example.com', 'Mailer');
- $mail->addAddress('myname@kabelmail.de', 'myname'); // Add a recipient
- // $mail->addAddress('ellen@example.com'); // Name is optional
- $mail->addReplyTo('myname@web.de', 'Antwort');
- //$mail->addCC('cc@example.com');
- //$mail->addBCC('bcc@example.com');
- //Attachments
- //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
- //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
- //Content
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = 'Here is the subject:localhost';
- $mail->Body = 'This is the HTML message body <b>in bold!</b>';
- $mail->AltBody = ' body in plain text for non-HTML mail lients';
- $mail->send();
- echo 'Message has been sent';
- } catch (Exception $e) {
- echo 'Message could not be sent.';
- echo 'Mailer Error: ' . $mail->ErrorInfo;
- }
- ?>
- [mail function]
- SMTP=smtp.kabelmail.de
- smtp_port=465
- sendmail_from = to@kabelmail.de
- sendmail_path ="C:xamppsendmailsendmail.exe"
- ;(I also tried sendmail_path = ""C:xamppsendmailsendmail.exe" -t" but without success.)
- mail.log="C:xamppphplogsphp_mail.log"
- [sendmail]
- smtp_server=smtp.kabelmail.de
- smtp_port=465
- smtp_ssl=auto
- error_logfile=error.log
- debug_logfile=debug.log
- auth_username=myname@kabelmail.de
- auth_password=mypassword
- SSL loaded 2018-01-11 12:06:10 SERVER -> CLIENT: 421 4.3.2 Too many open connections.
- 2018-01-11 12:06:10 CLIENT -> SERVER: EHLO localhost
- 2018-01-11 12:06:10 SERVER -> CLIENT:
- 2018-01-11 12:06:10 SMTP ERROR: EHLO command failed:
- 2018-01-11 12:06:10 SMTP NOTICE: EOF caught while checking if connected
- SMTP Error: Could not connect to SMTP host.
- SMTP Error: Could not connect to SMTP host.
- Message could not be sent.Mailer Error: SMTP Error: Could not connect to SMTP host.
- [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