iredmail-doc/html/change.mail.attachment.size...

200 lines
9.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Change mail attachment size</title>
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
<a href="https://www.iredmail.org" target="_blank">
<img alt="iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>&nbsp;
<span>iRedMail</span>
</a>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><div class="admonition note">
<p class="admonition-title">This tutorial is available in other languages. <a href="https://bitbucket.org/zhb/iredmail-docs/src">Help translate more</a></p>
<p><a href="./change.mail.attachment.size-it_IT.html">Italiano</a> / <a href="./change.mail.attachment.size-zh_CN.html">简体中文</a> /</p>
</div>
<h1 id="change-mail-attachment-size">Change mail attachment size</h1>
<div class="toc">
<ul>
<li><a href="#change-mail-attachment-size">Change mail attachment size</a><ul>
<li><a href="#change-message-size-limit-in-postfix">Change message size limit in postfix</a></li>
<li><a href="#change-upload-file-size-in-roundcube-webmail">Change upload file size in Roundcube webmail</a><ul>
<li><a href="#change-php-setting-to-allow-to-upload-large-attachment">Change PHP setting to allow to upload large attachment</a></li>
<li><a href="#change-roundcube-webmail-settings-to-allow-large-attachment">Change Roundcube webmail settings to allow large attachment</a></li>
</ul>
</li>
<li><a href="#change-upload-file-size-in-nginx">Change upload file size in Nginx</a></li>
<li><a href="#change-upload-file-size-in-sogo-3x">Change upload file size in SOGo-3.x</a></li>
<li><a href="#change-message-size-in-sogo-3x">Change message size in SOGo-3.x</a></li>
<li><a href="#change-attachment-size-limit-in-microsoft-outlook">Change attachment size limit in Microsoft Outlook</a></li>
</ul>
</li>
</ul>
</div>
<p>To change mail attachment size, we have to change 3 settings.</p>
<h2 id="change-message-size-limit-in-postfix">Change message size limit in postfix</h2>
<p>Postfix is MTA, so we have to change its setting to transfer mail with large
attachment.</p>
<p>For example, to allow mail with 100Mb attachment, please change both
<code>message_size_limit</code> and <code>mailbox_size_limit</code> settings like below:</p>
<pre><code># postconf -e message_size_limit=104857600
# postconf -e mailbox_size_limit=104857600
</code></pre>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>They don't have to be same. but <code>mailbox_size_limit</code> (size of the mailbox)
MUST be equal to or LARGER than <code>message_size_limit</code> (size of single email
message). Since per-user mailbox quota is enforced by Dovecot, so the
<code>mailbox_size_limit</code> is useless but required by Postfix.</p>
</div>
<p>Restart postfix to make it work:</p>
<pre><code># /etc/init.d/postfix restart
</code></pre>
<p><strong>NOTES</strong>:</p>
<ul>
<li><code>104857600</code> is 100 (MB) x 1024 (KB) x 1024 (Byte).</li>
<li>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.</li>
<li>If <code>mailbox_size_limit</code> is smaller than <code>message_size_limit</code>, you will get
error message in Postfix log file like this: <code>fatal: main.cf configuration
error: mailbox_size_limit is smaller than message_size_limit</code>.</li>
</ul>
<p>If you use mail clients such as Outlook, thunderbird to send mails, it's now
ok to sent large attachment with above setting.</p>
<h2 id="change-upload-file-size-in-roundcube-webmail">Change upload file size in Roundcube webmail</h2>
<p>If you have Roundcube webmail, please change two more settings:</p>
<h3 id="change-php-setting-to-allow-to-upload-large-attachment">Change PHP setting to allow to upload large attachment</h3>
<p>You should change <code>memory_limit</code>, <code>upload_max_filesize</code> and <code>post_max_size</code> in
PHP config file <code>/etc/php.ini</code></p>
<ul>
<li>on RHEL/CentOS: it's <code>/etc/php.ini</code></li>
<li>on Debian/Ubuntu, it's <code>/etc/php5/apache2/php.ini</code>.<ul>
<li>on Ubuntu 16.04 and later releases, it's <code>/etc/php/7.0/apache2/php.ini</code>
for Apache, or <code>/etc/php/7.0/fpm/php.ini</code> for Nginx + php-fpm.</li>
</ul>
</li>
<li>on FreeBSD, it's <code>/usr/local/etc/php.ini</code> for Apache, or
<code>/etc/php5/fpm/php.ini</code> for Nginx.</li>
<li>on OpenBSD, it's <code>/etc/php-5.4.ini</code>. If you're running different PHP release,
the version number <code>5.4</code> will be different.</li>
</ul>
<pre><code>memory_limit = 200M;
upload_max_filesize = 100M;
post_max_size = 100M;
</code></pre>
<h3 id="change-roundcube-webmail-settings-to-allow-large-attachment">Change Roundcube webmail settings to allow large attachment</h3>
<p>Change same settings in file <code>.htaccess</code> under roundcube root directory:</p>
<ul>
<li>on RHEL/CentOS, it's <code>/var/www/roundcubemail/.htaccess</code></li>
<li>on Debian/Ubuntu, it's <code>/usr/share/apache2/roundcubemail/.htaccess</code> or
<code>/opt/www/roundcubemail/.htaccess</code>.</li>
<li>on FreeBSD, it's <code>/usr/local/www/roundcubemail/.htaccess</code></li>
<li>on OpenBSD, it's <code>/var/www/roundcubemail/.htaccess</code></li>
</ul>
<p>Note: this <code>.htaccess</code> file may not exist on some Linux/BSD distributions,
if it doesn't exist, you can skip this step.</p>
<pre><code>php_value memory_limit 200M
php_value upload_max_filesize 100M
php_value post_max_size 100M
</code></pre>
<p>Restart Apache or php-fpm service to make it work.</p>
<h2 id="change-upload-file-size-in-nginx">Change upload file size in Nginx</h2>
<p>Find setting <code>client_max_body_size</code> in Nginx config file
<code>/etc/nginx/nginx.conf</code>, change it to a proper value to match your need.</p>
<pre><code>http {
...
client_max_body_size 100m;
...
}
</code></pre>
<h2 id="change-upload-file-size-in-sogo-3x">Change upload file size in SOGo-3.x</h2>
<p>SOGo-3.x introduces parameter <code>WOMaxUploadSize</code> to limit upload file size, you
can add it in SOGo config file <code>/etc/sogo/sogo.conf</code> with a proper attachment
size.</p>
<pre><code> // 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;
</code></pre>
<p>Restarting SOGo service is required.</p>
<h2 id="change-message-size-in-sogo-3x">Change message size in SOGo-3.x</h2>
<p>SOGo-3.2.5 introduces parameter <code>SOGoMaximumMessageSizeLimit</code> to limit message
size, you can add it in SOGo config file <code>/etc/sogo/sogo.conf</code> with a proper
size:</p>
<pre><code> // 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;
</code></pre>
<p>Restarting SOGo service is required.</p>
<h2 id="change-attachment-size-limit-in-microsoft-outlook">Change attachment size limit in Microsoft Outlook</h2>
<p>Outlook has its own attachment size limit, and will raise error like <code>The
attachment size exceeds the allowable limit.</code></p>
<p>To modify the default attachment limit size in Outlook on Windows system,
follow these steps:</p>
<ul>
<li>Exit Outlook.</li>
<li>Start Registry Editor.</li>
<li>Locate and then select one of the following registry subkeys:<ul>
<li>Manually create the path in the registry if it does not currently exist.</li>
<li>`14.01 means Outlook version number, it may be different on your system.</li>
</ul>
</li>
</ul>
<pre><code>HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\Outlook\Preferences
HKEY_CURRENT_USER\Software\Policies\Microsoft\Office\14.0\Outlook\Preferences
</code></pre>
<ul>
<li>
<p>Add the following registry data under this subkey:</p>
<ul>
<li>Value type: DWORD</li>
<li>Value name: MaximumAttachmentSize</li>
<li>Value data: An integer that specifies the total maximum allowable
attachment size. For example, specify 30720 (Decimal) to configure a
30-MB limit.</li>
</ul>
<p>Notes:</p>
<ul>
<li>Specify a value of zero (0) if you want to configure no limit for attachments.</li>
<li>Specify a value that is less than 20 MB if you want to configure a limit
that is less than the default 20 MB.</li>
</ul>
</li>
<li>
<p>Exit Registry Editor</p>
</li>
<li>Start Outlook.</li>
</ul>
<p>Reference: <a href="https://support.microsoft.com/en-us/kb/2222370">https://support.microsoft.com/en-us/kb/2222370</a></p><div class="footer">
<p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3293801-21"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-3293801-21');
</script>
</body></html>