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

146 lines
7.5 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改邮件附件大小</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://github.com/iredmail/docs">Help translate more</a></p>
<p><a href="./change.mail.attachment.size.html">English</a> / <a href="./change.mail.attachment.size-it_IT.html">Italiano</a> /</p>
</div>
<h1 id="_1">修改邮件附件大小</h1>
<div class="toc">
<ul>
<li><a href="#_1">修改邮件附件大小</a><ul>
<li><a href="#postfix">修改 postfix 中邮件大小的设置</a></li>
<li><a href="#roundcube">修改 Roundcube 网页邮箱的附件上传大小</a><ul>
<li><a href="#php">修改 PHP 设置允许上传大附件</a></li>
<li><a href="#roundcube_1">修改 Roundcube 网页邮箱设置以允许上传大附件</a></li>
</ul>
</li>
<li><a href="#nginx">限制 Nginx 上传文件大小</a></li>
<li><a href="#sogo">限制 SOGo 上传文件大小</a></li>
<li><a href="#outlook">修改 Outlook 程序的附件大小限制</a></li>
</ul>
</li>
</ul>
</div>
<p>要修改邮件附件大小,需要修改三个地方。</p>
<h2 id="postfix">修改 postfix 中邮件大小的设置</h2>
<p>Postfix 是一个邮件传送代理MTA因此要修改配置以使它能传送大附件的邮件。</p>
<p>假设要修改附件大小为 100MB需对 <code>message_size_limit</code><code>mailbox_size_limit</code>
做如下修改:</p>
<pre><code># postconf -e message_size_limit='104857600'
# postconf -e mailbox_size_limit='104857600'
</code></pre>
<p>之后重启 Postfix 服务,使上述修改生效:</p>
<pre><code># /etc/init.d/postfix restart
</code></pre>
<p><strong>注意</strong>:</p>
<ul>
<li><code>104857600</code> 是由 100 (MB) x 1024 (KB) x 1024 (Bit) 计算得到的结果。</li>
<li>邮件在发送前会被客户端OutlookThunderbird等重新编码导致邮件大小会超过
100MB所以建议将上述设置中的邮件大小改为 110MB 或 120MB 即可。</li>
<li>如果 <code>mailbox_size_limit</code> 的值比 <code>message_size_limit</code> 小,你会在 Postfix 日志
文件里看到这样的错误信息:<code>fatal: main.cf configuration error:
mailbox_size_limit is smaller than message_size_limit</code>.</li>
</ul>
<p>这样你就可以通过客户端正常发送邮件了。</p>
<h2 id="roundcube">修改 Roundcube 网页邮箱的附件上传大小</h2>
<p>如果使用 Roundcube 网页邮箱,需要额外更改两个地方:</p>
<h3 id="php">修改 PHP 设置允许上传大附件</h3>
<p>修改 PHP 配置文件 <code>/etc/php.ini</code> 中的 <code>memory_limit</code> <code>upload_max_filesize</code><code>post_max_size</code> 三个参数:</p>
<ul>
<li>在 RHEL/CentOS 系统上: 配置文件路径是 <code>/etc/php.ini</code></li>
<li>在 Debian/Ubuntu 系统上,配置文件路径是 <code>/etc/php5/apache2/php.ini</code></li>
<li>在 FreeBSD 系统上,配置文件路径是 <code>/usr/local/etc/php.ini</code> Apache或者是 <code>/etc/php5/fpm/php.ini</code> Nginx</li>
<li>在 OpenBSD 系统上,配置文件路径是 <code>/etc/php-5.4.ini</code>。如果你运行的 PHP 版本号为 5.4 ,路径将会不一样。</li>
</ul>
<pre><code>memory_limit = 200M;
upload_max_filesize = 100M;
post_max_size = 100M;
</code></pre>
<h3 id="roundcube_1">修改 Roundcube 网页邮箱设置以允许上传大附件</h3>
<p>修改 roundcube 目录下的 <code>.htaccess</code> 文件:</p>
<ul>
<li>在 RHEL/CentOS 系统上,此文件路径为 <code>/var/www/roundcubemail/.htaccess</code></li>
<li>在 Debian/Ubuntu 系统上,此文件路径为 <code>/usr/share/apache2/roundcubemail/.htaccess</code> 或者
<code>/opt/www/roundcubemail/.htaccess</code>.</li>
<li>在 FreeBSD 系统上,此文件路径为 <code>/usr/local/www/roundcubemail/.htaccess</code></li>
<li>在 OpenBSD 系统上,此文件路径为 <code>/var/www/roundcubemail/.htaccess</code></li>
</ul>
<p>注意:某些 Linux/BSD 发行版本可能没有 <code>.htaccess</code> 文件,此时你可以忽略此步骤。</p>
<pre><code>php_value memory_limit 200M
php_value upload_max_filesize 100M
php_value post_max_size 100M
</code></pre>
<p>重启 Apache 或 php-fpm 服务以使上述修改生效。</p>
<h2 id="nginx">限制 Nginx 上传文件大小</h2>
<p>在配置文件 <code>/etc/nginx/nginx.conf</code> 中找到参数 <code>client_max_body_size</code> ,按需要修改大小:</p>
<pre><code>http {
...
client_max_body_size 100m;
...
}
</code></pre>
<h2 id="sogo">限制 SOGo 上传文件大小</h2>
<p>SOGo-3.x 引入新参数 <code>WOMaxUploadSize</code> 用于限制上传文件的大小,请将它添加到 SOGo
配置文件 <code>/etc/sogo/sogo.conf</code> 里并设置一个合适的附件大小。</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>修改后需要重启 SOGo 服务。</p>
<h2 id="outlook">修改 Outlook 程序的附件大小限制</h2>
<p>Outlook 有自己的附件大小限制,如果超出限制会弹出错误信息 <code>The
attachment size exceeds the allowable limit.</code></p>
<p>如需要在 Windows 系统上修改 Outlook 程序的附件大小限制,请参照以下步骤:</p>
<ul>
<li>退出 Outlook 程序</li>
<li>运行注册表编辑器:开始 -&gt; 运行 -&gt; 输入 "regedit"</li>
<li>找到并选择以下任意一个条目:<ul>
<li>如果不存在可自行创建。</li>
<li>14.04 表示 Outlook 的版本号,在你的系统上可能不一样。</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>在以上条目底下添加注册表项:</p>
<ul>
<li>类型DWORD</li>
<li>名称MaximumAttachmentSize</li>
<li>一个用于表示最大附件大小的整数。例如30720 表示 30MB 限制。</li>
</ul>
<p>注意:</p>
<ul>
<li>设置为 0 表示无限制。</li>
<li>默认限制为 20MB。可设置小于 20MB 的附件大小。</li>
</ul>
</li>
<li>
<p>退出注册表编辑器。</p>
</li>
<li>启动 Outlook。</li>
</ul>
<p>参考文档: <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://github.com/iredmail/docs/">GitHub 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://github.com/iredmail/docs/archive/master.zip">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></body></html>