114 lines
5.8 KiB
HTML
114 lines
5.8 KiB
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="/index.html" target="_blank">
|
|
<img alt="iRedMail web site"
|
|
src="./images/logo-iredmail.png"
|
|
style="vertical-align: middle; height: 30px;"
|
|
/>
|
|
<span>iRedMail</span>
|
|
</a>
|
|
// <a href="./index.html">Document Index</a></div><div class="admonition note">
|
|
<p class="admonition-title">This tutorial is available in other languages</p>
|
|
<p><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>
|
|
</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>
|
|
|
|
<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 (Bit).</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></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>
|
|
<p>```
|
|
http {
|
|
...
|
|
client_max_body_size 100m;
|
|
...
|
|
}</p><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. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
|
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
|
|
ga('create', 'UA-3293801-21', 'auto');
|
|
ga('send', 'pageview');
|
|
</script>
|
|
</body></html> |