по заданному коду
$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('dhawal.b@itransparity.com', 'Mailer');
$mail->addAddress('dhawalbhatt21@gmail.com', 'Dhawal Bhatt'); // Add a recipient
// Name is optional
echo "Set the From and To <br>";
$mail->addReplyTo('dhawal.b@itransparity.com', 'Information');
$mail->addCC('dhawalbhatt21@gmail.com');
$mail->addBCC('dhawalbhatt21@gmail.com');
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;
}