Plesk

How to change the maximum attachment size for webmail on the Linux Plesk server?

Question

How to change the maximum attachment size for webmail on the Linux Plesk server?

Answer

RoundCube

To set the limit less or equal to 75MB (in the example the limit is set to 75MB, but less value may be set):

  1. Connect to the server via SSH.

    If direct SSH access to the server is not possible, contact the server administrator for further assistance.

  2. Change the PHP settings as follows in /etc/psa-webmail/roundcube/php.ini

    upload_max_filesize = 75M
    post_max_size = 75M 

To set the limit higher than 75MB (in this example the value is increased to 100MB):

  1. Connect to the server via SSH.

    If direct SSH access to the server is not possible, contact the server administrator for further assistance.

  2. Change the PHP settings as follows in /etc/psa-webmail/roundcube/php.ini

    upload_max_filesize = 100M
    post_max_size = 100M 

  3. Add the following line in /usr/share/psa-roundcube/config/config.inc.php file:

    $config['max_message_size'] = '133M';

    This value must be 133% higher than the required value.

To apply the change to all domains, it is required to modify the templates:

  1. Create the custom templates directory for webmail:

    # mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail

  2. Copy the template to the custom templates folder:

    # cp /usr/local/psa/admin/conf/templates/default/webmail/roundcube.php /usr/local/psa/admin/conf/templates/custom/webmail/

  3. Edit the FcgidMaxRequestLen directive in the custom template. The value should be specified in Bytes, 268435456 Bytes = 256MB (set the required value, 268435456 is given as an example only:)

    # sed -i '/FcgidMaxRequestLen/cFcgidMaxRequestLen 268435456' /usr/local/psa/admin/conf/templates/custom/webmail/roundcube.php

  4. Apply changes within the template to all webmails using the next command:

    # plesk repair web -server

Horde

  1. Connect to the server via SSH.

    Note: if direct SSH access to the server is not possible, contact server administrator for further assistance.

  2. Change the PHP settings as follows in /etc/psa-webmail/horde/horde/php.ini

    upload_max_filesize = 256M
    post_max_size = 256M 

  3. Modify also horde attach_size_limit value at /etc/psa-webmail/horde/imp/conf.php, it should be set to 0 (unlimited):

    # grep attach_size_limit /etc/psa-webmail/horde/imp/conf.php
    $conf['compose']['attach_size_limit'] = 0;

    Note: Set higher values if it is required.

  4. Modify templates and apply the change to all domains, perform the next steps. Create the custom templates directory for webmail:

    # mkdir -p /usr/local/psa/admin/conf/templates/custom/webmail

  5. Then copy the template to the custom templates folder:

    # cp /usr/local/psa/admin/conf/templates/default/webmail/horde.php /usr/local/psa/admin/conf/templates/custom/webmail/

  6. Edit the FcgidMaxRequestLen directive in the custom template:

    # sed -i '/FcgidMaxRequestLen/cFcgidMaxRequestLen 268435456' /usr/local/psa/admin/conf/templates/custom/webmail/horde.php

  7. Apply changes within the template to all webmails using the next command:

    # plesk repair web -server

Note: In case there is server-wide ModSecurity limitation or timeouts caused by bandwidth, refer to the additional steps below:

In case the server uses…