Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Download email/folder, using .eml format - Community#325 #2422

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

glenn2223
Copy link
Contributor

@glenn2223 glenn2223 commented Aug 23, 2022

Work towards Export/Copy/Backup Emails

This pull request is the first (hopefully of many 馃榿) towards .eml support.

This PR provides:

  • an option in the reply drop-down called "Download Email". Clicking this will prompt the user for the output directory and will save it upon selection
  • right-clicking folder (excluding Drafts, Unread, Starred) gives an option to "Export the folder" (this will not create a directory, it just saves the messages in the path provided)

Need

Approval for the image, or leave it as is (no image) - if you want the image, how do I add it (linking it doesn't work)

Can I have thoughts on sub-folders? Do we just recurse over them and create the subdirectories by default, maybe have an extra option to say "Export just this folder"?

Help

The issue: I started to export almost 1500 emails, then clicked on one, it was only after all 1500 downloaded that the email was rendered.

Possible solution: I need to be able to deprioritise a task, when it's sent to mailsync, or have a new action, something like Action.queueBackgroundTasks. Either way, this would sit these tasks at the sideline while the other (more important) tasks come through.

An option is available in the reply drop-down called "Download Email", clicking this will prompt the user for the output directory
@foundry376-bot
Copy link

This pull request has been mentioned on Mailspring Community. There might be relevant details there:

https://community.getmailspring.com/t/export-copy-backup-emails/325/17

@glenn2223 glenn2223 changed the title Download email as .eml format - Community#325 [WIP] Download email as .eml format - Community#325 Aug 24, 2022
A few changes:
- Right clicking on a folder (excluding Drafts, Unread, Starred) gives an option to "Export the %@ folder"
- In order to get this to work I needed to add the property/reference to the existing DB column `remoteFolderId`
- Sanitise regex utilities for paths
- Downloading a single email now has it's name sanitised to stop saving errors (i.e slashes, colons, etc.)
- Prettier/lint changes (for best practices)

**Issues:**
- Needs translations
- long running process ties up mailsync - need to deprioritise tasks or have a `Action.queueBackgroundTask` option
@glenn2223 glenn2223 changed the title [WIP] Download email as .eml format - Community#325 Download email as .eml format - Community#325 Aug 25, 2022
@glenn2223 glenn2223 changed the title Download email as .eml format - Community#325 Download email/folder, using .eml format - Community#325 Aug 25, 2022
@foundry376-bot
Copy link

This pull request has been mentioned on Mailspring Community. There might be relevant details there:

https://community.getmailspring.com/t/export-copy-backup-emails/325/18

@glenn2223 glenn2223 changed the title Download email/folder, using .eml format - Community#325 [WIP] Download email/folder, using .eml format - Community#325 Sep 13, 2022
@bengotow
Copy link
Collaborator

Hey hey - this looks great! I think you're right that mailsync needs a mechanism for background tasks, and we likely need just one background task to represent the "export folder" operation so that it's easy to cancel + attach progress. I'm a bit worried that queueing tons and tons of individual tasks might cause problems.

I like the idea of adding a "priority" value to tasks and then sorting by priority when mailsync retrieves a task to run. Maybe something like that would work?

@glenn2223
Copy link
Contributor Author

and we likely need just one background task to represent the "export folder" operation so that it's easy to cancel + attach progress. I'm a bit worried that queueing tons and tons of individual tasks might cause problems.

YES PLEASE!!!!!!!!!!!!!!!! 馃槀

And I agree, there wouldn't be an easy way of cancelling these tasks - if the user decided to

I like the idea of adding a "priority" value to tasks and then sorting by priority when mailsync retrieves a task to run. Maybe something like that would work?

That was my other choice and that would definitely work.


PS: sorry if there's any shoddy code. Full discretion, I have almost no experience with React and Electron 馃榿

@glenn2223 glenn2223 marked this pull request as draft October 27, 2022 13:43
@bengotow bengotow force-pushed the master branch 2 times, most recently from e0bdee2 to de5e87e Compare November 14, 2022 15:07
@bengotow bengotow force-pushed the master branch 5 times, most recently from 77d1cc7 to e2e0f88 Compare November 21, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants