Even if this post is so old, I can not help replying it because google push it to me at the first sight.
Hoppingly this reply could help the who is still fighting with this out a little bit.
I run my roundcubemail under KVM, typically LMNR(Linux+MySql+Nginx+Roundcubemail).
Here is a brief of my environment:
Host: HP GL380 G6 X5560x2, 64G Mem, CentOS 7.1, KVM
Guest: vCPUx2, 4G Mem, CentOS 7.1
Host and Guest have the minimal installation of CentOS. Guest also disabled selinux and firewall.
To make a successfully uploading, probably we have to do the following things:
1. SMTP service(postfix): message_size_limtBy default, postfix has a limit of 10M for message(reference:
http://www.postfix.org/postconf.5.html#message_size_limit). Actually, it's 9.7MB if one MB has 1024*1024 bytes. It decides the total of attachments you can send. But you can NOT send message as same as exact this value, it is 1.5 times of the total you can send by my experience. So the max size of your all attachments should be message_size_limt / 1.5. For example, 128M means you can send a mail with almost 85M attachments total. Also you will be noticed by the reference above that if the destination mail server can not accept attachments as same as the size of you , you will still experience failure. However, if you just test in local machine, the value will help you out "SMTP Service: message exceeds size limit" error.
Change or add following line in
/etc/postfix/main.cf:
# 128M max, so we can send 85M attachments for total.
message_size_limit = 134217728
2. NginxConfig
/etc/nginx/nginx.conf, change or add
client_max_body_size like this:
client_max_body_size 128m;
3. PHPChange the two values according to your needs, they decide how big file you can upload(but not the max size your mail server can accept).
post_max_size = 128M
upload_max_filesize = 128M
# Having plenty of memory
memory_limit = 512M
4. RoundcubemailMaking roundcubemail accept fatty file needs efforts:
1) program/steps/mail/attachments.inc99 if (!$err && $attachment['status'] && !$attachment['abort']) {
The checking of $attachment['status'] is always false so that your uploading won't go any further.
You can just omit it(of course, you take your own rick):
99 if (!$err && !$attachment['abort']) {
2) program/lib/Roundcube/rcube_cache.php48 private $max_packet = -1;
...
...
613 private function max_packet_size()
614 {
615 if ($this->max_packet < 0) {
616 $this->max_packet = 2097152; // default/max is 2 MB <---- This is max size of one attachment, you can upload many attachments but each must have a size less than 2MB.
My resolution is simple, and rude:
48 private $max_packet = 134217728; // 128M
3) program/lib/Roundcube/rcube_message.php66 const BODY_MAX_SIZE = 1048576; // 1MB
It may cause the famous 1046576 error, so change it accordingly:
66 const BODY_MAX_SIZE = 134217728; // 128MB
Before all, make sure the roundcubemail can read/write the uploading directory.
After all, restart postfix, php-fpm and nginx, open browser, upload and then prey.
Good luck!