Cannot save mail attachments

I cannot save mail attachments with the standard mail application.
If I try, I get the error message “Unable to save attachment to SD card”.
I double checked the storage permission is granted to the mail app, so this can’t be the problem.
The standard saving location (under Settings->Miscellaneous) is set to /storage/emulated/0/Download If I tap it to change it, the app crashes.
I can, however, open the attachment and view it.

I have a Fairphone 3+ with freshly installed e-0.12-q-2020111084008-dev-FP3

Does anyone else have this problem or knows how to fix this?

Regain your privacy! Adopt /e/ the unGoogled mobile OS and online servicesphone

cannot save mail attachments

Thank you, I added logs to the issue, we’ll see if they can help.

Hi, having same issue regardless of attachment file type (pdf, odt, png).

If I go Mail > settings> account settings > storage > storage location > the default is ‘regular internal storage’, I change to ‘external storage (SD card)’ then I exit settings and Mail crashes with popup saying “mail keeps stopping” which choice of ‘app info’ or ‘close app’.

Now if I check storage settings again, it has reverted back to ‘regular internal storage’.

If I go Mail > settings> global settings > Miscellaneous > the default is ‘save attachments to /stoage/emulated/0/Download’. If I click on that setting the window switches back to my email inbox without a chance to change it.

I don’t know how to check logs, I do not have adb or any such environment setup (yet :thinking: ).

Using GS290 purchased from /e/.

GS290 build number

For anyone still having this problem, what solved it for me was using a different email app. Using K-9 Mail (found in Apps) works great and attachements can save to internal storage or SD card without problem. The version I am using is K-9 Mail v 5.733, updated 2021-03-30.

On a side note, a weird thing happened when searching for email apps in Apps. When I searched for ‘Email’ it gave an error “something went wrong please try again later”. But when I searched for “mail”, it provided a list of email apps as expected (with K-9 being the first result).

There are 2 issues open on gitlab regarding the default mail app issue, hopefully they will be solved when devs have the time :smiley:


1 Like

I used the same workaround for the problem. My thing is, that I want to deactivate the notifcations of the /e/-mail app…
is there a sleek way to do it?

cheers and thanks

Do you mean getting ‘email’ notifications from /e/ mail app?

When I got my email account set up and working on the K-9 mail app, I then removed/deleted my email account from the default /e/ mail app and have not had any notifications from it since as it is not doing anything to notify me about.

1 Like

yep… that helped! Thanks a lot

Yes, problem still persist on my GS290 0.15-20210317106351.

Same for me, can’t save attachment, crash whem trying to change the path. Using FP2, e.foundation 0.16

1 Like

Yes, I have exactly the same problem, and could’nt find anywhere a tip to fix it…
Anyone?

Yeah, same boat. I can’t neither download attachments nor change path for downloads. I’m glad, it’s an already known issue.

I’m experiencing the same problem. With adb logcat I was able to find out a bit more:

06-15 06:25:19.125 10641 10641 E AndroidRuntime: FATAL EXCEPTION: main
06-15 06:25:19.125 10641 10641 E AndroidRuntime: Process: foundation.e.mail, PID: 10641
06-15 06:25:19.125 10641 10641 E AndroidRuntime: android.os.FileUriExposedException: file:///storage/emulated/0/Download exposed beyond app through Intent.getData()
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.os.StrictMode.onFileUriExposed(StrictMode.java:2083)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.net.Uri.checkFileUriExposed(Uri.java:2395)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.content.Intent.prepareToLeaveProcess(Intent.java:10794)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.content.Intent.prepareToLeaveProcess(Intent.java:10747)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.app.Instrumentation.execStartActivity(Instrumentation.java:1710)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.app.Activity.startActivityForResult(Activity.java:5210)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.app.Activity.startActivityForResult(Activity.java:5168)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at foundation.e.mail.helper.FileBrowserHelper.showFileBrowserActivity(FileBrowserHelper.java:91)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at foundation.e.mail.activity.setup.Prefs$6.onPreferenceClick(Prefs.java:418)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.preference.Preference.performClick(Preference.java:1165)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:260)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.widget.AdapterView.performItemClick(AdapterView.java:330)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.widget.AbsListView.performItemClick(AbsListView.java:1190)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.widget.AbsListView$PerformClick.run(AbsListView.java:3198)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.widget.AbsListView$3.run(AbsListView.java:4116)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:883)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:100)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7356)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:491)
06-15 06:25:19.125 10641 10641 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:940)

From https://stackoverflow.com/questions/38200282/android-os-fileuriexposedexception-file-storage-emulated-0-test-txt-exposed it seems that newer Android versions (Nougat and later) require apps to use content:// URLs instead of file:// URLs for Intent.getData(), and this error happens when file:// URLs are passed.

I also found out that the curent setting is stored in /data/data/foundation.e.mail/databases/preferences_storage, which happens to be an SQlite database. I’ve tried changing the setting directly in there with sqlite (update preferences_storage set value='content://com.android.externalstorage.documents/document/primary%3ADownload' where primkey='attachmentdefaultpath';), and Mail now shows that path in the preferences, but when I click on it it still dies, this time with

06-15 06:45:25.987 11455 11455 E AndroidRuntime: android.os.FileUriExposedException: file://content:/com.android.externalstorage.documents/document/primary%3ADownload exposed beyond app through Intent.getData()

So that didn’t help at all :frowning: I guess this has to be fixed somehow from e.foundation’s side, since they seem to have modified K-9 mail…

1 Like

The settings crash is tracked in https://gitlab.e.foundation/e/backlog/-/issues/2331, and there seems to be a merge request which can fix this: https://gitlab.e.foundation/e/apps/mail/-/merge_requests/22 Let’s hope this will get merged soon (and fixes the issue) :slight_smile:

Fix saving mail attachment error (!22) · Merge requests · e / apps / Mail · GitLab was merged three days ago. I’m not sure how the release process exactly works, but I guess that with the next update, it might work :slight_smile:

I have same error on moto g7 plus, but I can work around it by opening and selecting print and save to pdf.

I’ve also solved this with the workaround of using K-9 mail from apps, which is also in a far more recent dev-stage than /e/ OS version. With /e/ mail I also had issues with mail-sync and settings not being recognized, seems to be gone, hurray :slight_smile: