Setting sysadmin_get_storage_email without sysadmin module

Hi all,

I’ve done what I think is an extensive search on the topic. I’m trying to set my fromemail variable for the Backup and Restore FreePBX module to send me notification emails. I keep getting the “Unable to send backup email!” notifications. In looking through the /var/www/html/admin/modules/backup/functions.inc/class.backup.php file, I see the following lines:

                                    //Generic email
                                    $from = '[email protected]';
                                    //If we have sysadmin and "from is set"
                                    if(function_exists('sysadmin_get_storage_email')){
                                            $emails = sysadmin_get_storage_email();
                                            //Check that what we got back above is a email address
                                            if(!empty($emails['fromemail']) && filter_var($emails['fromemail'],FILTER_VALIDATE_EMAIL)){
                                                    $from = $emails['fromemail'];
                                            }
                                    }
                                    //If the user set an email in advanced settings it wins, otherwise take whatever won above.
                                    $from = filter_var($this->amp_conf['AMPBACKUPEMAILFROM'],FILTER_VALIDATE_EMAIL)?$this->amp_conf['AMPBACKUPEMAILFROM']:$from;

I see various references to sysadmin_get_storage_email and AMPBACKUPEMAILFROM.

I know that sysadmin_get_storage_email comes from the sysadmin module. But as this is really a fun project as opposed to a production PBX, I have opted (as yet) not to purchase the sysadmin. So, absent this module, is there any other way of setting the email?

Alternatively, I know I can set AMPBACKUPEMAILFROM in amportal.conf. But the first lines of amportal.conf warns:

#; Do NOT edit this file as it is auto-generated by FreePBX. All modifications to
#; this file must be done via the Web GUI. This file is IGNORED BY FreePBX
#; The purpose of this file is to allow legacy applications to still function by just reading ampportal.conf
#; #;--------------------------------------------------------------------------------

#;--------------------------------------------------------------------------------
#; All settings can be set from the Advanced Settings page accessible in FreePBX
#;--------------------------------------------------------------------------------

Since I don’t want to upset the FreePBX gods, I went to Advanced Settings, and enabled Display and Override Readonly Settings. I see an entry for AMPUSERMANEMAILFROM for emails from the user management module, but this is not the correct settings. In fact, despite the reference to AMPBACKUPEMAILFROM, I don’t see any entry (deprecated or otherwise) in amportal.conf.

So, I tried going into /var/www/html/admin/modules/backup/functions.inc/class.backup.php and replacing the email here:

                                        $from = '[email protected]';

only to realized I really angered the FreePBX gods, because it then put up a great big Security Warning that:
Module: "Backup & Restore", File: "/var/www/html/admin/modules/backup/functions.inc/class.backup.php altered"
Despite ignoring this error, it didn’t resolve the “Unable to send backup email!” notification.

So, I decided to push my luck with the FreePBX gods again, and this time add the following lines to the end of amportal.conf:

[email protected]

Same result. :face_with_raised_eyebrow:

So, I’m still where I started. Can anyone help? I can accept that there is no way around buying the sysadmin module, but since this is a just a side fun project, I thought I’d keep digging.

Thanks in advance.

b

  1. Pay for it by figuring it out yourself (hours spent * your self-worth)
  2. Pay someone else to build you something outside of the FreePBX system
  3. Pay $25.00 for system admin (which includes additional features and helps support and keep the project going.)

You might be able to find someone to work for free for you here, but it is up to chance. I can tell you the cheapest option by far will be system admin module. It is the only module we recommend on every box we provision, simply due to the overwhelming value of what you get compared to the time you would need to do it yourself.

Here is a matrix of what you get: System Admin - Feature Matrix - PBX GUI - Documentation

The from address setting in Sysadmin is configured in the Notificatoins section, and not a paid feature of sysadmin pro
https://wiki.freepbx.org/display/FPG/System+Admin+-+Notification+Settings

It looks like with the current version of the backup/restore module, that’s the only way to set the from address for email notices, the advanced setting appears to be gone now.

@comtech,

Your opinion is not invalid. I am fully aware of the value of the SysAdmin module. And yes, it’s only $25. Whether I own the module (which you’re assuming I do not), or whether I do not, is irrelevant. The question I posed is a technical one, not a commerical one.

Respectfully, I’d like to draw your attention to the URL of this forum - community.freepbx.org. This is an open source community. A community that has always been built on sharing, helping, and challenging one another. Forums like these enable discussions around possible bugs, or whether something is under-documented, changes, and stimulates and inspires those in the community to extend and contribute to this software.

1 Like

That’s what I thought. Of course, despite the backup/restore module being GPLv3+ license, the ability to be notified (especially when something fails), cannot be configured without the SysAdmin module. It may be necessary for the module owner to document this.

Thanks @lgaetz.

Open a feature request to add back the Advanced Setting to control this param. https://issues.freepbx.org/

Thanks… I’ll do just that. Thanks again!
https://issues.freepbx.org/browse/FREEPBX-23809

1 Like