-
Notifications
You must be signed in to change notification settings - Fork 6
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
How to use IMAP function 📧 #15
Comments
Hmm -- Like most modules in HPI, this supports any type of path (absolute, a
The part which determines which files are used is a recursive glob, so it should just search every folder listed in your configuration and try every file. You could also just try the following, to confirm its not matching anything...
Those should tell you what its computed as the target files I'm not sure what format the Thunderbird export tool uses, but it seems to be EML -- which I don't think is a raw email file, as far as I understand. Am not totally sure, formats in email have always been confusing to me. I definitely do know you can sync with IMAP with thunderbird, but not sure if it stores all your mail locally -- I can install it later today to see if I can figure that out. As a visual comparison, here is what one of my locally synced IMAP files looks like If you have something similar to that -- pointing it at the top folder which has all of those should work |
I tested out the addonn, and I think I've got it to work. Using the 'Plain Text Format', export that to a folder somewhere. It takes a while to do so: I just put that in In my config, I put:
And then:
If the This does mean you'd have to periodically do an export, but there isn't a great way around that with thunderbird. For context, I use mutt-wizard, which uses mbsync under the hood, so my mail gets synced with a local folder once every 5 minutes. |
Ah - may also be some issue with the different date format that the thunderbird addonn uses, looking into that |
Alright yeah -- the dates in the emails that the thunderbird addonn created weren't RFC 2822 compliant, so I created a wrapper to parse them manually if it wasn't able to do so: c4d87b7 Also updated the promnesia module, so you may have to Added Using the addon export, I now get visits from promnesia:
If mail was parsing for you before, it may have actually been this line causing the issues -- since the mail objects didn't have any datetimes, promnesia would ignore them. Hopefully thats fixed |
Ah, I also just remembered, since it takes about 30 minutes to run on my machine, I cache this once per month, so it picks up new URLs periodically. If you want me to make that configurable, let me know So if its still seems not to be working for you, you may have to delete the sqlite cachew file between testing if promnesia is working. That'd be in
To figure out where that is, run:
Let me know if you have any other issues, hopefully this isn't all too confusing |
Wow that was fast 😅. First of all, let me thank you for fixing this and showing the appropriate steps. I've now been able to index on of my Inboxs to test the display in Promnesia. Before using your IMAP source I was using the plaintext source from Promnesia and it was at least displaying surrounding text of the email body next to the URL. With your source I just get the file name. Nevertheless, yours has the advantage of having the email date! What I was trying to accomplish before (and thought that yours implemented) was to display the surrounding text but also the Date, From, Subject, To fields in the promnesia plugin. I've two more comments:
Thank you so much again for your help and work ! |
Theres an option in my promnesia module to display the text as the body, but with 8000 emails, the sqlite database tends to grow pretty fast (was something like 30GB on my end, since it copies the text for every URL it finds) See https://github.com/seanbreckenridge/promnesia/blob/master/promnesia_sean/sources/imap.py#L30 To enable that, in your config you can do something like:
Perhaps extracting a few lines around the message is preferable? Would increase the complexity/runtime a bit though. Will think about this
Hmm, am not sure if this is related to it being a namespace package, but I sorta doubt it. Don't have any experience with svn
Yeah, I've thought about this a bit as well. The best solution that perhaps I've come across for something like this is to use something like Since everything is local-first, I sort of don't see a huge issue, but if you want to bring it up, best place would probably be here |
Thank for the guidance on the security part ! Thanks for the tip on the IMAP. I understand now how your database grew so large, it is displaying not only the text of the whole email but all text from threads (when they exist). Is it not possible to just index the surronding text as the promnesia.auto promnesia.markdown, promnesia.plaintext (etc) do ? This way it would prevent the database from growing so huge and also just provide the relevant text in the Promnesia plugin to not clutter the side bar. In relation to extracting and displaying the From, To, Subject do you have any idea how to implement this ? I think maybe a simple |
Since all emails in plaintext begin like so:
It would suffice (???) to use something simple like this for each email file : From = ""
To = ""
Subject = ""
Date = ""
with open(email_file) as in_file:
for line in in_file:
if "From" in line.strip():
From = line.strip()
# etc etc
#If we want to obtain only the text after the From, To:
From.split(":",1)[0]
# etc etc
# Maybe we can just keep it ? I'm sure you'll know the best way though ! |
I think its already doing this? Relevant code is here It displays that as the Locator description, not the body -- don't think that should make a difference though, I think thats always shown I'll take a look at the markdown/plaintext modules from promnesia to see how they do it and see if I can figure out surrounding text; will leave this issue open for that purpose |
As just an FYI, https://github.com/seanbreckenridge/HPI/blob/master/my/imap.py#L72-L95 |
Ok I see. But what I was trying to achieve was to have something like:
I see that the date is nicely displayed already on the Promnesia addon in the same location as for browser history, so no need to extract that line 👍 Thank you again and looking out how this goes 😀 |
Since I think the config issues around IMAP/loading the text files has generally been solved here, gonna move it to an issue on the promnesia repo |
Sorry for commenting on a closed issue. I've found a way to automate this process for Thunderbird users, however it relies on using MBOX type files. Maybe this could be ported to promnesia, don't know how laborious that would be. |
Fine for you to comment here, all good https://github.com/seanbreckenridge/HPI/blob/master/CHANGELOG.md Ah I see, I updated the modules name/structure here so now the imap file is now I think it would make sense to add something like I can create an issue to track it 👍 |
Hello,
Thanks for this amazing extension of HPI that I just discovered. I was trying to setup this with Promnesia for my emails but I'm getting zero indexing:
I am using this Thunderbird Addon and I've tried to export with using:
All these export are in my .local/share/mail path, I even wrote the path literally in the init_ file instead of using
path,join
but nothing works.Thank you so much !
The text was updated successfully, but these errors were encountered: