After upgrade, email_queue.php gives "Email Queue is disabled in Default Settings"

Status
Not open for further replies.

gsupp

New Member
Apr 1, 2022
4
0
1
Houston, TX
I've upgraded from FusionPBX 4.5 to 5.1.1. I followed the steps in https://docs.fusionpbx.com/en/latest/status/email_queue.html to enable the email queue. However, when running "php /var/www/fusionpbx/app/email_queue/resources/service/email_queue.php" from the CLI, I get the message "Email Queue is disabled in Default Settings". I've checked my default settings and verified against a FusionPBX installation that has email_queue working and they appear the same. When I ran the update I was sure to update the Schema and App Defaults, per the email_queue instructions. Email sending works fine otherwise, so my SMTP settings appear correct.

Code:
root@pbx:/var/www/fusionpbx# php /var/www/fusionpbx/app/email_queue/resources/service/email_queue.php
Email Queue is disabled in Default Settings

1694440424944.png
I've tried reloading XML, clearing cache and restarting FreeSWITCH but get the same message.

I see the code in email_queue.php that checks for this:

Code:
//email queue enabled
        if ($_SESSION['email_queue']['enabled']['boolean'] != 'true') {
                echo "Email Queue is disabled in Default Settings\n";
                exit;
        }

But I'm not really sure how the settings in the DB make it into PHP session variables, or why the email_queue.enabled wouldn't be populated with true.
 
Try changing the default settings value 'True' to 'true' - all lowercase, save, reload button at the top-right of the default settings page and try your command again.
 
No, that will not matter. Obviously something else. Run every update option - 1 at a time, 1 after another and try again.
 
Same problem here. I have run the updates one at a time. . . no help. the php still says setting is disabled. It seems this just happened after I updated the source code earlier today.
 
Try changing the default settings value 'True' to 'true' - all lowercase, save, reload button at the top-right of the default settings page and try your command again.
The same thought crossed my mind, but as a boolean data type, there's just a dropdown for the True or False value. I tried a default settings reload just in case, no effect.

Run every update option - 1 at a time, 1 after another and try again.
I went back and ran all the upgrade steps again one at a time, in order. Step 1, step 2, step 2b, step 3, step 4, then step 5. Each completed with a successful message. Installation is now updated to master branch 11df74853a52524fc13de66c65a8b46e479a8349. Logged out and back in.

Server is running Ubuntu 20.04 with PHP 7.4. Running email_queue.php again from the CLI gives the same message:
Code:
root@pbx:/var/www/fusionpbx# php /var/www/fusionpbx/app/email_queue/resources/service/email_queue.php
Email Queue is disabled in Default Settings
 
I realize this is a terrible kludge, but if you comment out the check for the email_queue session variable in email_queue.php, it will then start working as expected.

Lines 90-94:
PHP:
//email queue enabled
      if ($_SESSION['email_queue']['enabled']['boolean'] != 'true') {
                echo "Email Queue is disabled in Default Settings\n";
                exit;
        }

Become:
PHP:
//email queue enabled
/*      if ($_SESSION['email_queue']['enabled']['boolean'] != 'true') {
                echo "Email Queue is disabled in Default Settings\n";
                exit;
        }*/

This will at least get email notifications working.
 
Thanks Gsupp.

That might work with php7.4, but with 8.1, and with the section commented, I get a new error:

PHP Fatal error: Uncaught TypeError: ksort(): Argument #1 ($array) must be of type array, null given in /var/www/fusionpbx/app/email_queue/resources/jobs/email_send.php:288
Stack trace:
#0 /var/www/fusionpbx/app/email_queue/resources/jobs/email_send.php(288): ksort()
#1 {main}
thrown in /var/www/fusionpbx/app/email_queue/resources/jobs/email_send.php on line 288
 
A Fresh install on Deibian 11 fixed the problem for me. I will make sure to have a recent backup before clicking on "upgrade" next time.
 
Status
Not open for further replies.