buen dia llevo ya hace meses tratando de resolver este detalle, bueno estoy tratando de enviar un mensaje con la libreria phpMailer, pero no consigo que funcione, me sale el error
Warning: fsockopen(): in C:\xampp\htdocs\envioPlantilla\js\correo\class.smt p.php on line 122
Error SMTP: No puedo conectar al servidor SMTP.
les escribo el codigo, aver
<?php
include('js/correo/class.phpmailer.php');
include('js/correo/class.smtp.php');
$mail = new PHPMailer;
// $mail->SMTPDebug = 3;
$SPLangDir = "js/correo/language/";
$mail->SMTPDebug = 0;
$mail->SetLanguage("es", $SPLangDir);
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPSecure = 'ssl';
$mail->SMTPAuth = true;
$mail->Username = 'email';
$mail->Password = 'pass';
// SMTP password
// $mail->Port = 587;
$mail->Port =465;
$mail->From = '[email protected]';
$mail->FromName = 'Test phpmailer';
$mail->addAddress('[email protected]');
$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';
if(!$mail->send()) {
echo $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>