Max upload mailattachment in Roundcube

Hi all,
I’ve read this thread:

Last post was from feb, saying there should be a “max message size” item in the webconfig.
The help function on the e-mail page still references a setting for this (“Accept message size to”), but it’s not present (It was in v6?).

Googling for max uploadsize in roundcube, many references to php.ini are found.
When looking in /etc/php.d/nethserver.ini, I see a setting upload_max_filesize = 2M. This is in line with the max mentioned in the userinface of roundcube. However, it looks like a general setting, but when using SOGo, I can upload larger attachments.

So, what is the best way to make sure I can upload larger attachments in Roundcube? (I think 10MB would be OK nowadays?)

OK, I found that manually editing /etc/php.d/nethserver.ini controls the max uploadsize in roundcube. (why doesn’t it control SOGo then…?)
That brings my question down to: what is the correct set prop syntax for this item? Otherwise, my manual intervention will be gone soon…
(And a hint for @docs_team to have a look at the mail-config help-page)

getting better every day

Hi Rolf, you can do with:

config setprop php UploadMaxFilesize 10
signal-event nethserver-php-update
2 Likes

Hi Marc,
thanks.
Where can I find the relation between the syntax in the ini file (upload_max_filesize) and the command you gave me?
(Same as you gave me the timezonesetting, it was another command then was written in the configfile later on.) When I know how to map these, I don’t have to ask this simple questions here…

It refers to the Queue message max size slider, present on the Messages tab. IIRC, according to the referenced post this specifies the max message size, including body and attachments.

It’s documented in the Developer Manual (see databases, templates, actions and events).

A simplified explanation could be that when a file contains a header message telling “do not modify this file…”, it is a template.

Templates are under /etc/e-smith/templates/. They can be overridden by custom templates. This is done by recreating the full path to the destination, but under the /etc/e-smith/templates-custom/ tree.

For instance, a basic procedure for a custom template of /etc/php.d/nethserver.ini could be:

  • Locate the template: /etc/e-smith/templates/etc/php.d/nethserver.ini/ (note templates can be composed of multiple fragments).
ls /etc/e-smith/templates/etc/php.d/nethserver.ini/
10base  template-begin
  • Find the setting you want to modify, either by reading the files or grepping them.
  • Once you know which file contains the setting, copy it to a custom template (note in some occasions it might be desirable to create an empty fragment with the additions, instead)
mkdir -p /etc/e-smith/templates-custom/etc/php.d/nethserver.ini/    #recreating the full file path
cp /etc/e-smith/templates/etc/php.d/nethserver.ini/10base /etc/e-smith/templates-custom/etc/php.d/nethserver.ini/    #copying the desired template fragment
  • Edit the copied file, setting the desired values and save the changes.
  • Manually expand the template, OR execute the related event:
    • Manually expanding the template:
      expand-template /etc/php.d/nethserver.ini
    • executing the related event:
      signal-event nethserver-php-update

By expanding the template you’ll see the changes applied to the original file (/etc/php.d/nethserver.ini)

Sometimes it is necessary to do additional actions after expanding the template. For instance when the file is only read by a service when it starts. In that case, you can manually restart the service to force it to read the file and apply the changes. Or…

…to simplify this, when multiple actions come into play, there are pre-made events. This events will expand the related templates and execute the required actions by issuing a single command (signal-event YOUR_EVENT). As it’s hard to remember every command I make extensive use of command auto-completion (tab key) to look for hints.

Something I often forget is to look for settings in the databases before creating a template. Remembering this could be a time-saver.

So instead of going ahead for a custom template, you can query (and edit) the NethServer databases by making use of the db and config commands. config command is limited to the configuration database whereas db command can access any database. As said before, use tab auto-completion for hints.

If the required setting is in the databases prefer it over a custom template.

Some useful command options are show, getprop, setprop:

# querying the configuration database (config command)
config show php
config getprop php UploadMaxFilesize

# querying the configuration database (db command)
db configuration show
db configuration getprop php UploadMaxFilesize

I would first query the databases to see if the setting I’m looking for is available, and also to know its value before the change.
Then replace the value (config setprop…) making sure to input the right syntax. Failing to do so may later lead to unexpected results.
After that, execute the related signal-event

5 Likes

I’m working on nethserver-phpscl, based this time on php-fpm, rather than the php-cgi, there is better performance. With my app you will be able to chose the php version you want (php56, php70, php71).
Like with cgi version of NS6, if you don’t load the php-mod, you cannot change the php setting on the fly like when apache is the handler of php. Therefore I provide some panels to change settings of php with a GUI

I could also provide the same GUI with nethserver-phpsettings, which is here to change the settings by some php_admin_value in the virtualhost, or create three applications, based on the plugin way in nethgui, that you might install individually, following your needs

5 Likes

Wow that’s a great answer man. It’s a huge example of database + template in practice. Can we extract a FAQ or guide from this?

please take a look to this post Need tests : nethserver-phpsettings

2 Likes

Thanks you saved my life :wink: