We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.


I have a multimodule project in which I want to use phpmailer. On each class of the phpmailer library I have added namespace on the first line as follows;

namespace App\Plugins\Mailer;

alongside the modules directories I have a plugins directory which contains the phpmailer classes. Am trying to access this classes within frontend module's controller.

This is what I have done;

In the Module.php

            'App\Frontend\Controllers' => __DIR__.'\controllers',
            'App\Plugins\Mailer'       => realpath(__DIR__.'\..\plugins\mailer'),

accessing the class within a controller in the frontend module. new \App\Plugins\mailer\PHPMailer


Fatal error: Class 'App\Plugins\Mailer\PHPMailer' not found in...

I have a feeling the issue is on routing since I have counter checked my paths but am not very sure..

Any help much appreciated

Hi !

Your file name is phpmailer.php in /plugins/mailer ? The name of class, must be the same as the filename.

Think to rename pop3.class.php and smtp.class.php to pop3.php and smtp.php and maybe change the "new SMTP()" with namespace if necessary !

Sorry for my english.

After quite a while I realize I still need PHpmailer.

I can autoad the class.

Now the problem is when I trigger mail send function the page runs for quite a while and returns 504 gateway error. I know what the error is about but can't figure out how to go about it as far as Phpmailer is concerned.