2016-05-19 06:51:20 -05:00
<!DOCTYPE html>
2015-08-13 19:17:35 -05:00
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" / >
< title > 修改邮件附件大小< / title >
2016-04-21 23:33:25 -05:00
< link rel = "stylesheet" type = "text/css" href = "./css/markdown.css" / >
2015-08-13 19:17:35 -05:00
< / head >
< body >
< div id = "navigation" >
2016-04-19 12:48:51 -05:00
< a href = "/index.html" target = "_blank" >
< img alt = "iRedMail web site"
2016-04-21 23:33:25 -05:00
src="./images/logo-iredmail.png"
2016-04-19 12:48:51 -05:00
style="vertical-align: middle; height: 30px;"
/>
< span > iRedMail< / span >
< / a >
2016-04-21 23:33:25 -05:00
// < a href = "./index.html" > Document Index< / a > < / div > < div class = "admonition note" >
2016-11-11 02:56:08 -06:00
< 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 >
2016-05-11 08:45:55 -05:00
< p > < a href = "./change.mail.attachment.size.html" > English< / a > / < a href = "./change.mail.attachment.size-it_IT.html" > Italiano< / a > /< / p >
2016-04-21 23:33:25 -05:00
< / div >
< h1 id = "_1" > 修改邮件附件大小< / h1 >
2015-08-13 19:17:35 -05:00
< 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 >
2016-05-18 21:21:55 -05:00
< li > < a href = "#nginx" > 限制 Nginx 上传文件大小< / a > < / li >
< li > < a href = "#sogo" > 限制 SOGo 上传文件大小< / a > < / li >
2016-09-17 21:58:35 -05:00
< li > < a href = "#outlook" > 修改 Outlook 程序的附件大小限制< / a > < / li >
2015-08-13 19:17:35 -05:00
< / ul >
< / li >
< / ul >
< / div >
< p > 要修改邮件附件大小,需要修改三个地方。< / p >
< h2 id = "postfix" > 修改 postfix 中邮件大小的设置< / h2 >
< p > Postfix 是一个邮件传送代理( MTA) , 因此, 要修改配置以使它能传送大附件的邮件。< / p >
2015-08-13 20:07:26 -05:00
< p > 假设要修改附件大小为 100MB, 需对 < code > message_size_limit< / code > 和 < code > mailbox_size_limit< / code >
做如下修改:< / p >
2015-08-13 19:17:35 -05:00
< pre > < code > # postconf -e message_size_limit='104857600'
2015-08-13 20:07:26 -05:00
# postconf -e mailbox_size_limit='104857600'
2015-08-13 19:17:35 -05:00
< / 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 > 邮件在发送前会被客户端( Outlook, Thunderbird等) 重新编码, 导致邮件大小会超过
100MB, 所以建议将上述设置中的邮件大小改为 110MB 或 120MB 即可。< / li >
2015-08-13 20:07:26 -05:00
< 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 >
2015-08-13 19:17:35 -05:00
< / 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 >
2016-05-18 21:21:55 -05:00
< h2 id = "nginx" > 限制 Nginx 上传文件大小< / h2 >
2015-08-13 19:17:35 -05:00
< p > 在配置文件 < code > /etc/nginx/nginx.conf< / code > 中找到参数 < code > client_max_body_size< / code > ,按需要修改大小:< / p >
2016-05-18 21:21:55 -05:00
< pre > < code > http {
2015-08-13 19:17:35 -05:00
...
client_max_body_size 100m;
...
2016-05-18 21:21:55 -05:00
}
< / 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 >
2016-09-17 21:58:35 -05:00
< 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 > 运行注册表编辑器:开始 -> 运行 -> 输入 "regedit"< / li >
2016-09-17 22:06:10 -05:00
< li > 找到并选择以下任意一个条目:< ul >
< li > 如果不存在可自行创建。< / li >
< li > 14.04 表示 Outlook 的版本号,在你的系统上可能不一样。< / li >
< / ul >
< / li >
2016-09-17 21:58:35 -05:00
< / 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 >
2016-09-17 22:06:10 -05:00
< li > 设置为 0 表示无限制。< / li >
< li > 默认限制为 20MB。可设置小于 20MB 的附件大小。< / li >
< / ul >
< / li >
< li >
< p > 退出注册表编辑器。< / p >
< / li >
2016-09-17 21:58:35 -05:00
< li > 启动 Outlook。< / li >
2016-09-17 21:59:50 -05:00
< / 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" >
2016-05-19 06:51:20 -05:00
< 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 = "http://www.iredmail.org/contact.html" > contact us< / a > to fix it.< / p >
< / div >
< script type = "text/javascript" >
2015-08-13 19:17:35 -05:00
(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 >