Skip to content

Email Client#199

Draft
domai-tb wants to merge 31 commits into
masterfrom
Email-Client
Draft

Email Client#199
domai-tb wants to merge 31 commits into
masterfrom
Email-Client

Conversation

@domai-tb

@domai-tb domai-tb commented May 19, 2025

Copy link
Copy Markdown
Member

E-Mail Client

This update introduces an integrated E-Mail client for RUB mails.

Features

  • E-Mail Client UI: Write, Edit, Delete, Show etc.
  • IMAP-Anbindung der E-Mails und Directories / Folder

Code Quality / Internals

  • Unit-Testing (ideally)

@domai-tb

domai-tb commented Jun 30, 2025

Copy link
Copy Markdown
Member Author

Hey @H1b4x thank your for your work! 🙏🏼

Some task that need to be done before we can release the email client in production:

  • Different email folders should not "stack". The backwards button should always lead to the "More" page instead of the inbox. Currently, folders like send, trash etc. are "stacked" on top of the view.
  • Load user defined folders from server. Currently it just loads the inbox, spam, send, archives, drafts and trash.
  • The settings button should either removed entirely or some settings should be implemented. The settings should be united with the general app settings page.
  • A background service for cyclic fetching up-to-date emails and displaying a notification should be implemented.
  • Drafts aren't stored properly on server side. See [1]
  • Handle @media CSS within HTML body. See Flutter HTML Issue 1060. Should be implemented within the SytledHtml widget.
  • Stabilize widget tree and avoid dynamic calls (over async gaps) to handle Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe. At this point the state of the widget's element tree is no longer stable.
  • Implement and handle attachments properly.

[1]
Screenshot_2025-06-30_13_26_51

@domai-tb

domai-tb commented Aug 3, 2025

Copy link
Copy Markdown
Member Author

We need to manually handle the dependency enough_email due the outdated package on pub.dev. See this issue. The error message with an up-to-date SDK is the following:

❯ flutter pub add enough_mail
The current Dart SDK version is 3.8.1.

Because enough_mail <1.0.0 doesn't support null safety and enough_mail >=1.0.0 <2.1.2 depends on intl ^0.17.0, enough_mail <2.1.2 requires intl ^0.17.0.
And because enough_mail >=2.1.2 <2.1.6 depends on intl ^0.18.0 and enough_mail >=2.1.6 depends on intl ^0.19.0, every version of enough_mail requires intl ^0.17.0 or ^0.18.0 or ^0.19.0.
So, because campus_app depends on both intl ^0.20.2 and enough_mail any, version solving failed.

The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.
For details, see https://dart.dev/null-safety
Failed to update packages.

As the package maintainer doesn't seem to provide a update in the near future, we should fork the repository like we did with the video player plugin too.

domai-tb and others added 6 commits October 21, 2025 12:40
…ent, and implemented backgground fetch with authentication and UID based notification
- the branch previously did not run due to an unsupported Kotlin version error, with the sentry_flutter update this branch builds again
- resolved merge conflicts
- changed login screen implementation to be compatible with master branch (email Client now has its own page until a central login screen replaces all individual login screens)
- reset ticket login screen implementation to master version
- created an authentication page that handles the visual loading while authenticating and fetching emails
- seperated UI loading concern from login screen
- added back button to loading page
- fixed navigation after logout (return to more page after logout)
- loading now works correctly after inital login
- we now do lazy fetching for the emails -> we fetch the headers only and then the bodies when an email is opened
- the email bodies have been improved (MIME Tree structure), most if not all email bodies are now displayed (primarily in plain text -> displaying as many HTML bodies successfully as possible is still a TODO)
- added fetching emails by their UID into services and repo layers
- Flags are now fetched properly
@Nicole-Dhm Nicole-Dhm assigned Nicole-Dhm and unassigned H1b4x, Nicole-Dhm and Aldalati May 1, 2026
Nicole-Dhm added 5 commits May 4, 2026 17:56
- we now check before every IMAP operation if our IMAP connection is alive, if it isn't we try to reset and reconnect
- the previous check wasn't catching the SocketException, this check is now replaced by the wrapper function managing the connection status
- resolved the delay in the IMAP reconnect with a function timeout to force a reconnect when we can't detect the connection loss with the exceptions and errors
- broadend erros being caught in the reconnect cycle
- added a keep alive that pings the IMAP client with a NOOP every 5 minutes, this will also drastically reduce the amount of times we need to iniate a whole reconnect
- switched to InAppWebView to display html email bodies (still TODO: refactor layout when an email displays HTML, because SingleChildScrollView and InAppWebView don't mesh well)
- exported loading of the email bodies to the email view itself instead of being called from email pages (for this email view was converted to a stateful widget)
- added loading spinner to email bodies loading
- to accomadate the InAppWebView better the layout now has different cases for plaintext and html bodies, plaintext has the same scrolling behaviour as before, scrolling the header. HTML bodies now have a fixed header so the scrolling in the web view works much smoother and doesn't figth with an outer scroll behaviour
- since we block images in HTML bodies per default (for privacy), we check if a HTML body email has images and give the user a load button that lets them load in the images
- web views now no longer handle their own height dynamically but expand to the size they need right away, which is much more robust
- extracted widgets into build functions to improve overview of the widget tree and avoid redundant code
- when saving a draft, we now no longer have mulitple duplicate drafts and only save one draft, "replaacing" the draft each time
- since the rub dovecot server does not support the IMAP replace operation we save a new draft with a combination of delete the existing one and appending the new one
- we now ask the user for their email address on init, since we do not have direct access to it. It is saved in the secure storage
- we check the email address for the @ format combined with the RUB email .de ending
- from the email we automatically generate a suggested Display Name, which the user can choose to overwrite. It is also saved in the secure storage
- we now save the draft bodies correctly in the MIME format
- draft bodies now display correctly
- drafts only save on PopScope when the content has truly changed
- we're keeping track of the drafts with the help of their Email headers now, so as to not save mutliple versions
- opening the Drafts drawer is now correctly routed to the drafts page
- drafts are now editable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Paused

Development

Successfully merging this pull request may close these issues.

4 participants