
PHPMailer
Publicado por luis (3 intervenciones) el 09/07/2019 17:49:48
hola alguien podria ayudarme necesito enviar correros masivos y estoy utilizando phpmailer pero me sale este error
Message Error: SMTP Error: Could not connect to SMTP host.
Message Error: SMTP Error: Could not connect to SMTP host.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'Phpmailer/Exception.php';
require 'Phpmailer/PHPMailer.php';
require 'Phpmailer/SMTP.php';
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 0; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '@gmail.com'; // SMTP username
$mail->Password = 'mipassword'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = '587'; // TCP port to connect to
//Recipients
$mail->setFrom('@gmail.com', '');
$mail->addAddress('@gmail.com', ''); // Add a recipient
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Este es un correo de prueba';
$mail->Body = 'Mi mensaje de prueba <b>in bold!</b>';
$mail->send();
echo 'Message enviado correctamente';
} catch (Exception $e) {
echo "Message Error: {$mail->ErrorInfo}";
}
Valora esta pregunta


0