0
follows the used code taken from the latest version of github I found
<?php
// Import PHPMailer classes into the global namespace
// These must be at the top of your script, not inside a function
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
//Load composer's autoloader
require 'PHPMailer/PHPMailer.php';
require 'PHPMailer/SMTP.php';
require 'PHPMailer/Exception.php';
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtp.dominiodahostnet.com.br';
$mail->SMTPAuth = true;
$mail->Username = 'usuario=dominiodahostnet.com.br';
// SMTP username
$mail->Password = '****';
//$mail->SMTPSecure = 'tls';
$mail->Port = 587;
//Recipients
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]', 'Joe User');
//$mail->addAddress('[email protected]'); l
//$mail->addReplyTo('[email protected]', 'Information');
//$mail->addCC('[email protected]');
//$mail->addBCC('[email protected]');
//Attachments
//$mail->addAttachment('/var/tmp/file.tar.gz');
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');
//Content
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
}
Below the error generated
2017-09-20 17:58:23 SERVER -> CLIENT: 220 smtpq.f1.k8.com.br ESMTP Postfix
2017-09-20 17:58:23 CLIENT -> SERVER: EHLO www.dominiodahostnet.com.br
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
2017-09-20 17:58:23 CLIENT -> SERVER: STARTTLS
2017-09-20 17:58:23 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
SMTP Error: Could not connect to SMTP host.
2017-09-20 17:58:23 CLIENT -> SERVER: QUIT
2017-09-20 17:58:23 SERVER -> CLIENT:
2017-09-20 17:58:23 SMTP ERROR: QUIT command failed:
SMTP Error: Could not connect to SMTP host.
Message could not be sent.Mailer Error: SMTP Error: Could not connect to SMTP host.
Warning that I am performing the tests directly from the server and not by the localhost
It wouldn’t be $mail->Username = 'dominiodahostnet.com.br'; instead of $mail->Username = '
usuario
=dominiodahostnet.com.br';– user60252
No, the Use name of the Hostnet server and this way
– Juliano Silveira
Okay, one more acquired knowledge
– user60252