Следуя приведенному коду
$this->load->library("phpmailer_library");
$mail = $this->phpmailer_library->load();
// Passing `true` enables exceptions
echo "started<br>";
try {
//Server settings
$mail->isSMTP(); // Set mailer to use SMTP
$mail->SMTPDebug = 1; // Enable verbose debug output
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->Port = 465; // TCP port to connect to
$mail->isHTML(true); // Set email format to HTML
$mail->Username = '****'; // SMTP username
$mail->Password = '*****'; // SMTP password
echo "Oject is working<br>";
//Recipients
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress('[email protected]', 'Dhawal Bhatt'); // Add a recipient
// Name is optional
echo "Set the From and To <br>";
$mail->addReplyTo('[email protected]', 'Information');
$mail->addCC('[email protected]');
$mail->addBCC('[email protected]');
echo "Set the reply to and CC and BCC <br>";
//Attachments
$mail->addAttachment('C:/xampp/htdocs/welnext_product2/files/list_of_cases.csv','list_of_cases'); // Add attachments
echo "Attachment config is working<br>";
//Content
$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';
echo "Email config is working<br>";
$mail->send();
echo 'Message has been sent<br>';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
Возможный дубликат Ошибка подключения SMTP () PHPmailer - PHP
спасибо, я только что настроил сервер XAMPP перед отправкой почты, поэтому он не работает.
Тогда я предлагаю вам закрыть этот вопрос, так как он никому не поможет.
Как закрыть вопрос ???






Здесь недостаточно информации. Похоже, вы используете старую версию PHPMailer, вы не читали руководство по устранению неполадок PHPMailer, и я думаю, вы не искали здесь похожие вопросы.