I have installed centos web panel and have set up all things. there have two sites hosted. When I try to send email using PHPmailer. there has an error.
2018-09-20 15:15:10 CLIENT -> SERVER: EHLO localhost
2018-09-20 15:15:10 SERVER -> CLIENT: 250-vps203527.vps.ovh.ca250-PIPELINING250-SIZE 204800000250-ETRN250-STARTTLS250-AUTH PLAIN LOGIN250-AUTH=PLAIN LOGIN250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN
2018-09-20 15:15:10 CLIENT -> SERVER: STARTTLS
2018-09-20 15:15:11 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
SMTP Error: Could not connect to SMTP host.
2018-09-20 15:15:11 CLIENT -> SERVER: QUIT
2018-09-20 15:15:11
2018-09-20 15:15:11
SMTP Error: Could not connect to SMTP host.
Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.
2018-09-20 15:15:10 SERVER -> CLIENT: 220 vps203527.vps.ovh.ca ESMTP Postfix
$mail = new PHPMailer(true); // Passing `true` enables exceptions
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'vps203527.vps.ovh.ca'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'admin@ .com'; // SMTP username
$mail->Password = ''; // SMTP password
$mail->SMTPSecure = false; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
//Recipients
$mail->setFrom('admin@.com', 'Test Mail');
$mail->addAddress('@gmail.com', 'Joe User'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$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. Mailer Error: ', $mail->ErrorInfo;
}
This is the php code i using