PHPMailer class not found error when sending email (Wappler 7 Beta 30, macOS)

Details:

Hi everyone,

I'm encountering an issue with Wappler 7 Beta 30 on macOS, using PHP

I created a mailer component named mail. Everything seems to be configured correctly, but when the Server Connect flow attempts to send the email, I get the following error:

{
  "code": 0,
  "file": "/var/www/html/dmxConnectLib/modules/mail.php",
  "line": 51,
  "message": "Class \"PHPMailer\\PHPMailer\\PHPMailer\" not found",
  "trace": "#0 /var/www/html/dmxConnectLib/lib/App.php(224): modules\\mail->send(Object(stdClass), '', NULL)\n#1 /var/www/html/dmxConnectLib/lib/App.php(196): lib\\App->execSteps(Object(stdClass))\n#2 /var/www/html/dmxConnectLib/lib/App.php(164): lib\\App->execSteps(Array)\n#3 /var/www/html/dmxConnectLib/lib/App.php(153): lib\\App->exec(Object(stdClass), false)\n#4 /var/www/html/dmxConnectLib/lib/App.php(114): lib\\App->exec(Object(stdClass), false)\n#5 /var/www/html/dmxConnect/api/broker_application.php(7): lib\\App->define(Object(stdClass))\n#6 {main}"
}

This happens both locally and when running inside a Docker PHP image or on a standard PHP server.

What I've tried:

  • Rebuilding the project.
  • Verifying file permissions.
  • Checking if PHPMailer is installed in dmxConnectLib.

Question:

How can I fix it ?

Thanks in advance for any help!

Is the use of PHP Composer enabled in your project? And if so is it executed on the server.

Yes, it is activated. I'm checking the normal PHP server (not Docker) and it says:
Composer version 2.6.5 2023-10-06 10:11:52

well if it is setup and available then you should run it on your remote server, so that all packages are installed.

it is not yet running ?
Composer version 2.6.5 2023-10-06 10:11:52

Sorry @George but seeing same issue on a newly created project (PHP local server)

{
* code: 0,
* file: "E:\webs\imap-extension-php\www\dmxConnectLib\modules\mail.php",
* line: 51,
* message: "Class "PHPMailer\PHPMailer\PHPMailer" not found",
* trace: "#0 E:\webs\imap-extension-php\www\dmxConnectLib\lib\App.php(224): modules\mail->send(Object(stdClass), '', NULL) #1 E:\webs\imap-extension-php\www\dmxConnectLib\lib\App.php(164): lib\App->execSteps(Object(stdClass)) #2 E:\webs\imap-extension-php\www\dmxConnectLib\lib\App.php(114): lib\App->exec(Object(stdClass), false) #3 E:\webs\imap-extension-php\www\dmxConnect\api\sender.php(8): lib\App->define(Object(stdClass)) #4 {main}"

}

but mail.php is present

Win 11.

log file in case it is any use
wappler.zip (2.1 KB)

1 Like

Done some checking, the entire PHPMailer directory is not being added.

Manually added a copy from an old install and all working as it should

@updates you have access to a copy or shall I pm you one with instructions?

Ignore last, seems like manuallly clicking "Update PHP packages does the install
image

(so long since i did anything in PHP!)

I had the same problem too. Clicking 'Update PHP packages...' didn't add the missing folders. I added them manually.

How does Composer determine which packages should be installed?

With reference to the composer.json file in the root of the project

image

Example:

{
  "require": {
    "php": ">=5.6",
    "ext-curl": "*",
    "ext-gd": "*",
    "ext-hash": "*",
    "ext-json": "*",
    "ext-mbstring": "*",
    "ext-openssl": "*",
    "ext-pcre": "*",
    "ext-pdo": "*",
    "ext-session": "*",
    "phpmailer/phpmailer": "^6.8.0"
  },
  "config": {
    "platform": {
      "php": "5.6.0"
    },
    "platform-check": true
  }
}

@George as an aside, should PHP version minimum still be 5.6?

I seem to recall some server actions needed a later version, around 7.3 + if i recall correctly?

Thanks Brian. My composer.json file looks like this too, but the phpmailer packages are not installed.

Brian,

@updates is talking about his remote server not the local Wappler development…

Locally Wappler runs the composer install that then downloads and installs the packages locally.

However for the remote server a different composer install commands needs to be run on the web server itself (usually done on the hosting panel)

This is similar to how NodeJS packages also get installed, there a separate npm install is required, php with composer is the same.