Limit messages size to 10 MB

pull/174/head
M66B 5 years ago
parent e29ef76d59
commit 9b15168b0e

@ -2546,6 +2546,9 @@ FairEmail will workaround this is in most cases, so this message can mostly be c
The error *...SendFailedException...* means that there was a problem while sending a message. The error *...SendFailedException...* means that there was a problem while sending a message.
The error will almost always include a reason. Common reasons are that the message was too big or that one or more recipient addresses were invalid. The error will almost always include a reason. Common reasons are that the message was too big or that one or more recipient addresses were invalid.
The warning *Message too large to fit into the available memory* means that the message was larger than 10 MiB.
Even if your device has plenty of storage space Android provides limited working memory to apps, which limits the size of messages that can be handled.
Please see [here](#user-content-faq22) for other error messages in the outbox. Please see [here](#user-content-faq22) for other error messages in the outbox.
<br /> <br />

@ -93,6 +93,7 @@ public class MessageHelper {
private MimeMessage imessage; private MimeMessage imessage;
static final int SMALL_MESSAGE_SIZE = 64 * 1024; // bytes static final int SMALL_MESSAGE_SIZE = 64 * 1024; // bytes
static final int MAX_MESSAGE_SIZE = 10 * 1024 * 1024; // bytes
static final int DEFAULT_ATTACHMENT_DOWNLOAD_SIZE = 256 * 1024; // bytes static final int DEFAULT_ATTACHMENT_DOWNLOAD_SIZE = 256 * 1024; // bytes
static final long ATTACHMENT_PROGRESS_UPDATE = 1500L; // milliseconds static final long ATTACHMENT_PROGRESS_UPDATE = 1500L; // milliseconds
@ -1250,6 +1251,10 @@ public class MessageHelper {
String result; String result;
Part part = (html == null ? plain : html); Part part = (html == null ? plain : html);
if (part.getSize() > MAX_MESSAGE_SIZE) {
warnings.add(context.getString(R.string.title_insufficient_memory));
return null;
}
try { try {
Object content = part.getContent(); Object content = part.getContent();

@ -701,6 +701,7 @@
<string name="title_no_search">Search on server is not available for this account</string> <string name="title_no_search">Search on server is not available for this account</string>
<string name="title_too_large">Message too large to completely reformat</string> <string name="title_too_large">Message too large to completely reformat</string>
<string name="title_truncated">Message too large to display completely</string> <string name="title_truncated">Message too large to display completely</string>
<string name="title_insufficient_memory">Message too large to fit into the available memory</string>
<string name="title_show_full">Show full message</string> <string name="title_show_full">Show full message</string>
<string name="title_unused_inline">Unused inline images will be removed on send</string> <string name="title_unused_inline">Unused inline images will be removed on send</string>
<string name="title_accross_remark">Messages moved across accounts will be downloaded again resulting in extra data usage</string> <string name="title_accross_remark">Messages moved across accounts will be downloaded again resulting in extra data usage</string>

Loading…
Cancel
Save