From ae4a8fe8005d0f202703fdd7514c4def023b0cc0 Mon Sep 17 00:00:00 2001
From: Andris Reinman <andris@kreata.ee>
Date: Sun, 12 Mar 2017 00:23:46 +0200
Subject: [PATCH] Set APPEND max size in config

---
 config/default.js | 4 +++-
 imap.js           | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/config/default.js b/config/default.js
index f1e52779..7cc776a8 100644
--- a/config/default.js
+++ b/config/default.js
@@ -31,7 +31,9 @@ module.exports = {
         host: '127.0.0.1',
         //key: '/path/to/server/key.pem'
         //cert: '/path/to/server/cert.pem'
-        secure: true
+        secure: true,
+        // Max size for messages uploaded via APPEND
+        maxMB: 5
     },
 
     lmtp: {
diff --git a/imap.js b/imap.js
index 4268dbe4..cf34d2ff 100644
--- a/imap.js
+++ b/imap.js
@@ -24,7 +24,8 @@ let serverOptions = {
         info: log.silly.bind(log, 'IMAP'),
         debug: log.silly.bind(log, 'IMAP'),
         error: log.error.bind(log, 'IMAP')
-    }
+    },
+    maxMessage: config.imap.maxMB * 1024 * 1024
 };
 
 if (config.imap.key) {