2014-09-30 19:03:36 -05:00
|
|
|
# Change mail attachment size
|
|
|
|
|
2014-09-30 19:19:50 -05:00
|
|
|
[TOC]
|
|
|
|
|
2018-09-06 04:26:09 -05:00
|
|
|
Mail attachment size is configured in multiple places with default iRedMail settings:
|
|
|
|
|
2018-09-06 04:40:22 -05:00
|
|
|
- Postfix is the MTA, it checks the size of each received and sent message.
|
2018-09-06 04:26:09 -05:00
|
|
|
- Dovecot is the LDA (local delivery agent), it checks mailbox size (a.k.a. mailbox quota)
|
|
|
|
- Nginx / Apache is web server, if you upload mail attachment via webmail, web
|
2018-09-06 04:40:22 -05:00
|
|
|
server checks the size of uploaded mail attachment.
|
|
|
|
- Roundcube webmail, SOGo have their own message size limit settings, but
|
|
|
|
they're not enabled by iRedMail by default, so they use web server upload
|
|
|
|
size instead.
|
2018-09-06 04:26:09 -05:00
|
|
|
- Desktop mail client application like Outlook may have its own message size
|
|
|
|
limit.
|
2014-09-30 19:03:36 -05:00
|
|
|
|
|
|
|
## Change message size limit in postfix
|
|
|
|
|
|
|
|
Postfix is MTA, so we have to change its setting to transfer mail with large
|
|
|
|
attachment.
|
|
|
|
|
2015-08-13 20:07:26 -05:00
|
|
|
For example, to allow mail with 100Mb attachment, please change both
|
|
|
|
`message_size_limit` and `mailbox_size_limit` settings like below:
|
2014-09-30 19:03:36 -05:00
|
|
|
|
|
|
|
```
|
2017-05-29 00:21:40 -05:00
|
|
|
# postconf -e message_size_limit=104857600
|
|
|
|
# postconf -e mailbox_size_limit=104857600
|
2014-09-30 19:03:36 -05:00
|
|
|
```
|
|
|
|
|
2017-05-29 00:21:40 -05:00
|
|
|
!!! note
|
|
|
|
|
2018-09-06 04:30:34 -05:00
|
|
|
* They don't have to be same. but `mailbox_size_limit` (size of the mailbox)
|
|
|
|
MUST be equal to or LARGER than `message_size_limit` (size of single email
|
|
|
|
message).
|
|
|
|
* Postfix is configured to pipe received email to Dovecot for local mail
|
|
|
|
delivery, so the `mailbox_size_limit` setting is not used, but we still
|
|
|
|
need this setting to surpress Postfix warning while starting Postfix
|
|
|
|
service.
|
2017-05-29 00:21:40 -05:00
|
|
|
|
2014-09-30 19:03:36 -05:00
|
|
|
Restart postfix to make it work:
|
|
|
|
|
|
|
|
```
|
|
|
|
# /etc/init.d/postfix restart
|
|
|
|
```
|
|
|
|
|
|
|
|
__NOTES__:
|
|
|
|
|
2017-03-31 04:06:55 -06:00
|
|
|
* `104857600` is 100 (MB) x 1024 (KB) x 1024 (Byte).
|
2014-09-30 19:03:36 -05:00
|
|
|
* Mail will be encoded by mail user agent (Outlook, Thunderbird, etc) before
|
|
|
|
transferred, the actual message size will be larger than 100MB, you can
|
|
|
|
simplily increase above setting to 110Mb or 120Mb to make it work as expected.
|
2015-08-13 20:07:26 -05:00
|
|
|
* If `mailbox_size_limit` is smaller than `message_size_limit`, you will get
|
|
|
|
error message in Postfix log file like this: `fatal: main.cf configuration
|
|
|
|
error: mailbox_size_limit is smaller than message_size_limit`.
|
2014-09-30 19:03:36 -05:00
|
|
|
|
|
|
|
If you use mail clients such as Outlook, thunderbird to send mails, it's now
|
|
|
|
ok to sent large attachment with above setting.
|
|
|
|
|
2018-09-06 05:39:28 -05:00
|
|
|
## Change message size limit in iRedAPD
|
|
|
|
|
|
|
|
> * iRedAPD is a Postfix policy server developed and maintained by iRedMail team.
|
|
|
|
> * With default iRedMail setting, no message size limit is set.
|
|
|
|
> * For more details, please check tutorial: [Manage iRedAPD](./manage.iredapd.html).
|
|
|
|
|
|
|
|
With plugin `throttle` enabled in iRedAPD config file (`/opt/iredapd/settings.py`),
|
|
|
|
iRedAPD will query throttle settings from SQL database (SQL table `iredapd.throttle`),
|
|
|
|
if there's a global, per-domain or per-user message size limit set for sender
|
|
|
|
or recipient, it will performs the check.
|
|
|
|
|
|
|
|
Both Postfix and iRedAPD check the size of single message, if the message size reaches
|
|
|
|
the limit of either Postfix setting or iRedAPD throttle setting, the email will
|
|
|
|
be rejected.
|
|
|
|
|
|
|
|
You can set the throttle with iRedAdmin-Pro, or with SQL command tool, for more
|
|
|
|
details, please check plugin source file, it's detailed with examples and
|
|
|
|
explanation: [Throttle plugin](https://bitbucket.org/zhb/iredapd/src/default/plugins/throttle.py).
|
|
|
|
|
2014-09-30 19:03:36 -05:00
|
|
|
|
2015-03-23 07:15:15 -06:00
|
|
|
If you have Roundcube webmail, please change two more settings:
|
2014-09-30 19:03:36 -05:00
|
|
|
|
2019-03-20 07:59:31 -06:00
|
|
|
## Change PHP settings to upload large file
|
2014-09-30 19:03:36 -05:00
|
|
|
|
2019-03-20 07:59:31 -06:00
|
|
|
Please also update PHP config file `php.ini` to allow uploading large file:
|
2014-09-30 19:03:36 -05:00
|
|
|
|
|
|
|
* on RHEL/CentOS: it's `/etc/php.ini`
|
2017-06-05 08:58:16 -05:00
|
|
|
* on Debian/Ubuntu, it's `/etc/php5/apache2/php.ini`.
|
|
|
|
* on Ubuntu 16.04 and later releases, it's `/etc/php/7.0/apache2/php.ini`
|
|
|
|
for Apache, or `/etc/php/7.0/fpm/php.ini` for Nginx + php-fpm.
|
2014-09-30 19:03:36 -05:00
|
|
|
* on FreeBSD, it's `/usr/local/etc/php.ini` for Apache, or
|
|
|
|
`/etc/php5/fpm/php.ini` for Nginx.
|
|
|
|
* on OpenBSD, it's `/etc/php-5.4.ini`. If you're running different PHP release,
|
|
|
|
the version number `5.4` will be different.
|
|
|
|
|
|
|
|
```
|
|
|
|
memory_limit = 200M;
|
|
|
|
upload_max_filesize = 100M;
|
|
|
|
post_max_size = 100M;
|
|
|
|
```
|
|
|
|
|
2019-03-20 07:59:31 -06:00
|
|
|
## Roundcube webmail
|
|
|
|
|
|
|
|
Roundcube uses its own setting `max_message_size` to limit message size, please
|
|
|
|
add or update this parameter in its config file:
|
|
|
|
|
|
|
|
* on RHEL/CentOS, it's `/opt/www/roundcubemail/config/config.inc.php`.
|
|
|
|
Old iRedMail releases use `/var/www/roundcubemail/config/config.inc.php`.
|
|
|
|
* on Debian/Ubuntu, it's `/opt/www/roundcubemail/config/config.inc.php`.
|
|
|
|
Old iRedMail releases use `/usr/share/apache2/roundcubemail/config.inc.php`.
|
|
|
|
* on FreeBSD, it's `/usr/local/www/roundcubemail/config/config.inc.php`
|
|
|
|
* on OpenBSD, it's `/opt/www/roundcubemail/config/config.inc.php`.
|
|
|
|
Old iRedMail releases use `/var/www/roundcubemail/config.inc.php`.
|
|
|
|
|
|
|
|
```
|
|
|
|
$config['max_message_size'] = '100M';
|
|
|
|
```
|
|
|
|
|
2014-09-30 19:19:50 -05:00
|
|
|
### Change Roundcube webmail settings to allow large attachment
|
2014-09-30 19:03:36 -05:00
|
|
|
|
|
|
|
Change same settings in file `.htaccess` under roundcube root directory:
|
|
|
|
|
|
|
|
* on RHEL/CentOS, it's `/var/www/roundcubemail/.htaccess`
|
2015-06-03 23:35:48 -05:00
|
|
|
* on Debian/Ubuntu, it's `/usr/share/apache2/roundcubemail/.htaccess` or
|
|
|
|
`/opt/www/roundcubemail/.htaccess`.
|
2014-09-30 19:03:36 -05:00
|
|
|
* on FreeBSD, it's `/usr/local/www/roundcubemail/.htaccess`
|
|
|
|
* on OpenBSD, it's `/var/www/roundcubemail/.htaccess`
|
|
|
|
|
2015-03-23 07:15:15 -06:00
|
|
|
Note: this `.htaccess` file may not exist on some Linux/BSD distributions,
|
|
|
|
if it doesn't exist, you can skip this step.
|
|
|
|
|
2014-09-30 19:03:36 -05:00
|
|
|
```
|
2014-09-30 19:19:50 -05:00
|
|
|
php_value memory_limit 200M
|
2014-09-30 19:03:36 -05:00
|
|
|
php_value upload_max_filesize 100M
|
|
|
|
php_value post_max_size 100M
|
|
|
|
```
|
|
|
|
|
2015-08-13 19:17:35 -05:00
|
|
|
Restart Apache or php-fpm service to make it work.
|
2015-03-23 07:15:15 -06:00
|
|
|
|
2015-08-13 19:17:35 -05:00
|
|
|
## Change upload file size in Nginx
|
2015-03-23 07:15:15 -06:00
|
|
|
|
|
|
|
Find setting `client_max_body_size` in Nginx config file
|
2019-03-11 08:14:37 -06:00
|
|
|
`/etc/nginx/conf-enabled/client_max_body_size.conf`, change the size to a
|
|
|
|
proper value to match your need.
|
|
|
|
|
|
|
|
!!! attention
|
|
|
|
|
|
|
|
Old iRedMail releases set this parameter in `/etc/nginx/nginx.conf`.
|
2015-03-23 07:15:15 -06:00
|
|
|
|
|
|
|
```
|
2019-03-11 08:14:37 -06:00
|
|
|
client_max_body_size 100m;
|
2016-05-18 21:21:55 -05:00
|
|
|
```
|
|
|
|
|
2019-03-11 08:14:37 -06:00
|
|
|
Reloading or restarting Nginx service is required.
|
|
|
|
|
2018-09-06 04:48:46 -05:00
|
|
|
## Change file size limits in SOGo
|
2016-05-18 21:21:55 -05:00
|
|
|
|
2018-09-06 04:48:46 -05:00
|
|
|
SOGo config file is `/etc/sogo/sogo.conf` (Linux/OpenBSD) or
|
|
|
|
`/usr/local/etc/sogo/sogo.conf` (FreeBSD), 2 settings are relevant to message size:
|
|
|
|
|
|
|
|
* SOGo-3.x introduces parameter `WOMaxUploadSize` to limit upload file size.
|
|
|
|
* SOGo-3.2.5 introduces parameter `SOGoMaximumMessageSizeLimit` to limit single
|
|
|
|
message size.
|
2016-05-18 21:21:55 -05:00
|
|
|
|
|
|
|
```
|
2017-01-10 21:55:23 -06:00
|
|
|
// set the maximum allowed size for content being sent to SOGo using a PUT or
|
|
|
|
// a POST call. This can also limit the file attachment size being uploaded
|
|
|
|
// to SOGo when composing a mail.
|
|
|
|
//
|
|
|
|
// - The value is in kilobyte.
|
|
|
|
// - By default, the value is 0, or disabled so no limit will be set.
|
|
|
|
WOMaxUploadSize = 102400;
|
|
|
|
|
|
|
|
// Parameter used to set the maximum allowed email message size when
|
|
|
|
// composing a mail.
|
|
|
|
// The value is in kilobytes. By default, the value is 0, or disabled so
|
|
|
|
// no limit will be set.
|
|
|
|
SOGoMaximumMessageSizeLimit = 102400;
|
2016-05-18 21:21:55 -05:00
|
|
|
```
|
|
|
|
|
2018-09-06 04:48:46 -05:00
|
|
|
Restarting SOGo service is required if you changed any setting in SOGo config file.
|
2016-09-17 21:58:35 -05:00
|
|
|
|
|
|
|
## Change attachment size limit in Microsoft Outlook
|
|
|
|
|
|
|
|
Outlook has its own attachment size limit, and will raise error like `The
|
|
|
|
attachment size exceeds the allowable limit.`
|
|
|
|
|
|
|
|
To modify the default attachment limit size in Outlook on Windows system,
|
|
|
|
follow these steps:
|
|
|
|
|
|
|
|
* Exit Outlook.
|
|
|
|
* Start Registry Editor.
|
|
|
|
* Locate and then select one of the following registry subkeys:
|
2016-09-17 22:06:10 -05:00
|
|
|
* Manually create the path in the registry if it does not currently exist.
|
|
|
|
* `14.01 means Outlook version number, it may be different on your system.
|
2016-09-17 21:58:35 -05:00
|
|
|
|
|
|
|
```
|
|
|
|
HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Preferences
|
|
|
|
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Outlook\Preferences
|
|
|
|
```
|
|
|
|
|
|
|
|
* Add the following registry data under this subkey:
|
|
|
|
|
|
|
|
* Value type: DWORD
|
|
|
|
* Value name: MaximumAttachmentSize
|
|
|
|
* Value data: An integer that specifies the total maximum allowable
|
|
|
|
attachment size. For example, specify 30720 (Decimal) to configure a
|
|
|
|
30-MB limit.
|
|
|
|
|
2016-09-17 22:06:10 -05:00
|
|
|
Notes:
|
2016-09-17 21:58:35 -05:00
|
|
|
|
|
|
|
* Specify a value of zero (0) if you want to configure no limit for attachments.
|
|
|
|
* Specify a value that is less than 20 MB if you want to configure a limit
|
|
|
|
that is less than the default 20 MB.
|
|
|
|
|
|
|
|
* Exit Registry Editor
|
|
|
|
* Start Outlook.
|
2016-09-17 21:59:50 -05:00
|
|
|
|
|
|
|
Reference: <https://support.microsoft.com/en-us/kb/2222370>
|