diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java
index 140a7bebb6..62c4897873 100644
--- a/app/src/main/java/eu/faircode/email/FragmentCompose.java
+++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java
@@ -326,6 +326,7 @@ public class FragmentCompose extends FragmentBase {
private static final int COPY_ATTACHMENT_TIMEOUT = 60; // seconds
private static final int MAX_QUOTE_LEVEL = 5;
+ private static final int MAX_REASONABLE_SIZE = 5 * 1024 * 1024;
private static final int REQUEST_CONTACT_TO = 1;
private static final int REQUEST_CONTACT_CC = 2;
@@ -6922,7 +6923,10 @@ public class FragmentCompose extends FragmentBase {
}
}
- Helper.writeText(draft.getFile(context), body);
+ File f = draft.getFile(context);
+ Helper.writeText(f, body);
+ if (f.length() > MAX_REASONABLE_SIZE)
+ args.putBoolean("large", true);
String full = HtmlHelper.getFullText(body);
draft.preview = HtmlHelper.getPreview(full);
@@ -7296,6 +7300,9 @@ public class FragmentCompose extends FragmentBase {
bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(draft.revision > 1);
bottom_navigation.getMenu().findItem(R.id.action_redo).setVisible(draft.revision < draft.revisions);
+ if (args.getBoolean("large"))
+ ToastEx.makeText(getContext(), R.string.title_large_body, Toast.LENGTH_LONG).show();
+
if (args.getBundle("extras").getBoolean("silent")) {
etBody.setTag(null);
return;
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e52708bc23..1d716e8675 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -2237,6 +2237,7 @@
Do not ask this again
Do not ask this again for %1$s
No message text found
+ This message is very large and this may cause problems!
Unsupported encoding: %1$s
Via: %1$s
1 hour