1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Limit messages size to 10 MB

This commit is contained in:
M66B 2020-02-20 12:44:49 +01:00
parent e29ef76d59
commit 9b15168b0e
3 changed files with 9 additions and 0 deletions

3
FAQ.md
View file

@ -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 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.
<br />

View file

@ -93,6 +93,7 @@ public class MessageHelper {
private MimeMessage imessage;
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 long ATTACHMENT_PROGRESS_UPDATE = 1500L; // milliseconds
@ -1250,6 +1251,10 @@ public class MessageHelper {
String result;
Part part = (html == null ? plain : html);
if (part.getSize() > MAX_MESSAGE_SIZE) {
warnings.add(context.getString(R.string.title_insufficient_memory));
return null;
}
try {
Object content = part.getContent();

View file

@ -701,6 +701,7 @@
<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_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_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>