Welcome Guest, Not a member yet? Register   Sign In
Class "PHPMailer\PHPMailer\PHPMailer" not found
#1

I'm using CodeIgniter 4 and I'm trying add PHPMailer to my project via a composer:

Quote:composer require phpmailer/phpmailer

[Image: TNIYc.png]

My Controller:

PHP Code:
<?php

namespace App\Controllers;

use 
CodeIgniter\Controller;
use 
App\Models\IssueModel;
use 
PHPMailer\PHPMailer\PHPMailer;
use 
PHPMailer\PHPMailer\SMTP;
use 
PHPMailer\PHPMailer\Exception;

class 
Issues extends Controller {

    public function create() {
        if ($this->request->getMethod() == 'post') {
            .... // some code here
                $issueModel = new IssueModel();

                $mail = new PHPMailer(true);

                $mail->SMTPDebug SMTP::DEBUG_SERVER;
                $mail->isSMTP();
                $mail->Host      'mai';
                $mail->SMTPAuth  true;
                $mail->Username  'noreply';
                $mail->Password  'pass';
                $mail->SMTPSecure PHPMailer::ENCRYPTION_SMTPS;
                $mail->Port      587;

                ..... // some code here
    }




And I have this error:

Quote:Class "PHPMailer\PHPMailer\PHPMailer" not found

Where is a problem?
Reply


Messages In This Thread
Class "PHPMailer\PHPMailer\PHPMailer" not found - by mazz - 08-31-2022, 05:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB