-
Notifications
You must be signed in to change notification settings - Fork 0
Email import plugin #3
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add native iOS AppleCalendarService.swift for EventKit integration - Add Dart AppleCalendarService wrapper for Flutter platform channels - Add ActionItemIntegration enum with Apple Calendar support - Add preferences extension for export destination persistence - Update ActionItemTileWidget with dropdown export selection and Calendar export functionality - Add Apple Calendar logo asset - Update AppDelegate.swift with Calendar method channel registration This enables users to export action items directly to Apple Calendar with permission handling, event creation, and user feedback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new email import plugin that allows users to fetch emails from an IMAP mailbox, extract actionable memories from them, and submit them to the OMI API. The plugin provides a Flask-based web interface for email credential management and selective memory extraction.
Key changes include:
- Implementation of a Flask backend with IMAP connectivity and memory extraction logic
- HTML frontend for user interaction with email fetching and memory submission
- Rule-based heuristics for extracting actionable items from email content
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app.py | Flask backend implementing IMAP connectivity, email parsing, and OMI API integration |
| index.html | Frontend interface for IMAP credentials and email message selection |
| README.md | Documentation with setup instructions and feature overview |
| requirements.txt | Python dependencies including Flask and email parsing libraries |
| sample.eml | Example email file for testing without IMAP connection |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import time | ||
| import json | ||
| import imaplib | ||
| import email |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code imports the standard library 'email' module but requirements.txt specifies 'email-parser==0.1.5' which is not used anywhere in the code. This creates confusion about dependencies. Remove the unused email-parser dependency from requirements.txt.
|
|
||
| <form id="fetch-form"> | ||
| <label for="host">IMAP Host</label> | ||
| <input type="text" id="host" placeholder="imap.example.com" autocomplete="username"> |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The autocomplete attribute 'username' is incorrect for an IMAP host field. It should be 'off' or removed entirely, as this field contains server hostnames, not usernames.
| <input type="text" id="host" placeholder="imap.example.com" autocomplete="username"> | |
| <input type="text" id="host" placeholder="imap.example.com"> |
| try: | ||
| imap = imaplib.IMAP4_SSL(host, port) if port == 993 else imaplib.IMAP4(host, port) |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using plain IMAP4 connection for non-993 ports creates a security vulnerability by transmitting credentials in plain text. Consider using STARTTLS for non-SSL connections or restricting to SSL-only connections.
| try: | |
| imap = imaplib.IMAP4_SSL(host, port) if port == 993 else imaplib.IMAP4(host, port) | |
| if port == 993: | |
| imap = imaplib.IMAP4_SSL(host, port) | |
| else: | |
| imap = imaplib.IMAP4(host, port) | |
| imap.starttls() |
| """ | ||
| memories = [] | ||
| lines = body.splitlines() | ||
| action_pattern = re.compile(r'^\s*(?:\d+[\).]|[-*\u2022]|todo|action[:\-])', re.IGNORECASE) |
Copilot
AI
Aug 26, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The regex pattern uses a Unicode bullet character (\u2022) but doesn't handle other common bullet characters like '►', '⦁', or '‣' that might appear in emails. Consider expanding the pattern or documenting the limitation.
| action_pattern = re.compile(r'^\s*(?:\d+[\).]|[-*\u2022]|todo|action[:\-])', re.IGNORECASE) | |
| action_pattern = re.compile(r'^\s*(?:\d+[\).]|[-*\u2022\u2023\u25BA\u2981]|todo|action[:\-])', re.IGNORECASE) |
closes BasedHardware#3241 before: https://github.com/user-attachments/assets/d00d815c-8419-4c1b-96fb-ec20365fba44 logs: ``` flutter: ----------------FIREBASE CRASHLYTICS---------------- flutter: Bad state: No element flutter: #0 ListBase.firstWhere (dart:collection/list.dart:132:5) #1 SharedPreferencesUtil.disableApp (package:omi/backend/preferences.dart:255:22) #2 _AppDetailPageState._toggleApp (package:omi/pages/apps/app_detail/app_detail.dart:1129:13) #3 _AppDetailPageState.build.<anonymous closure> (package:omi/pages/apps/app_detail/app_detail.dart:576:48) #4 _AnimatedLoadingButtonState._handleOnPressed (package:omi/widgets/animated_loading_button.dart:38:27) #5 _InkResponseState.handleTap (package:flutter/src/material/ink_well.dart:1204:21) #6 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:345:24) #7 TapGestureRecognizer.handleTapUp (package:flutter/src/gestures/tap.dart:758:11) #8 BaseTapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:383:5) #9 BaseTapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:353:7) #10 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:173:27) #11 ``` after: https://github.com/user-attachments/assets/26ea5c91-e73a-44f4-ba76-4b804876c5df <img width="1032" height="257" alt="Screenshot 2025-10-18 at 11 15 52 PM" src="https://github.com/user-attachments/assets/44e4e46b-b654-4599-84ee-8ee0920b1cd3" />
This PR adds an email import plugin under
plugins/example/import/email-import.The plugin provides a Flask web interface to connect to an IMAP mailbox (or use a local .eml file), extract actionable "memories" from messages via rule-based heuristics, and submit them to the OMI API. It includes:
README.mdwith setup and usage detailsapp.pyFlask backend to fetch emails, extract memories, and post to OMIindex.htmlUI for entering IMAP credentials and selecting messagesrequirements.txtlisting required Python packagessample.emlexample email for testingThe memory extraction heuristics look for lines starting with bullets, numbers, TODO, or Action prefixes, cleaning up the text and limiting to 500 characters.
This addresses issue BasedHardware#1895 (Import data from email).