Reply
Thread Tools
Posts: 669 | Thanked: 433 times | Joined on May 2010
#1
Is there a way to search for an email (search from/to/subject/body through all emails) using a customized search string somehow?
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#2
If you mean searching e-mails that Modest keeps in its cache (or e-mail that you have actively stored in a local folder), *and* you don't mind using the power of regular expressions, you can do the following:

$ find ~/.modest/cache/mail -name \*.~ | xargs grep "findme"

This will go through all locally-cached e-mails and for each one it will look for the "findme" string (learn to use grep and you'll never look back

Obviously this is not fully practical, as it will display the full path of the e-mails matching the input string. With suitable scripting you could print, for each e-mail found, the from/to/date/subject header and perhaps a couple of context lines.

Alternatively, if you make this into some kind of interactive program, you could present the list to the user and allow to click on a result and open modest showing that e-mail (probably there's some dbus-ish way of doing this).

If you use alpine (like I do), you can use "alpine -F /path/to/e-mail" to view the e-mail (with e.g. the option to forward).

But then you need to, before piping it to pine, add a fake "From .." line so that it conforms to the mbox format.

Hey, this looks like an idea for a nice script.
 

The Following 2 Users Say Thank You to reinob For This Useful Post:
Posts: 669 | Thanked: 433 times | Joined on May 2010
#3
i hoped that there will be an application that does it already or an option i missed, but i guess eventually that there's nothing like some bash scripting
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#4
He, that was fun:

Code:
BASEPATH=$HOME/.modest/cache/mail
MBOXVIEW=alpine -F

SEARCHSPEC="-s -i $1"

for m in $(find $BASEPATH -name \*.~ | xargs grep -l $SEARCHSPEC | uniq)
do
	$MBOXVIEW $m
done
(typed by hand, so may not work straight out of the box).

It searches for the expression you give it and for each e-mail found it displays it using alpine. When you hit "Q" it jumps to the next e-mail that was found, until you've seen them all.

Need to work on on-the-fly patching the modest e-mails to that they display as a proper e-mail in alpine (the "From " trick didn't work).
 

The Following 3 Users Say Thank You to reinob For This Useful Post:
Posts: 112 | Thanked: 30 times | Joined on Jun 2012 @ Jeddah,Saudi Arabia
#5
is there any other email app for n900 except the stock one?
 
Posts: 669 | Thanked: 433 times | Joined on May 2010
#6
I'm having some difficulties installing alpine - posted here:

http://talk.maemo.org/showpost.php?p...5&postcount=12
 
Posts: 1,808 | Thanked: 4,272 times | Joined on Feb 2011 @ Germany
#7
Originally Posted by unexpected View Post
is there any other email app for n900 except the stock one?
Claws-mail (GUI, but not optimized for a small touch screen), alpine (non-graphical UI, can use the stylus for clicking around), mutt (some people like it, I prefer alpine).
 
Posts: 669 | Thanked: 433 times | Joined on May 2010
#8
Originally Posted by reinob View Post
He, that was fun:

Code:
BASEPATH=$HOME/.modest/cache/mail
MBOXVIEW=alpine -F

SEARCHSPEC="-s -i $1"

for m in $(find $BASEPATH -name \*.~ | xargs grep -l $SEARCHSPEC | uniq)
do
	$MBOXVIEW $m
done
(typed by hand, so may not work straight out of the box).

It searches for the expression you give it and for each e-mail found it displays it using alpine. When you hit "Q" it jumps to the next e-mail that was found, until you've seen them all.

Need to work on on-the-fly patching the modest e-mails to that they display as a proper e-mail in alpine (the "From " trick didn't work).
this script works great - any advices for user experience improvements ?
for example - there is much stuff in each email that is not needed (headers etc.) - can it be cleaned?

Is it possible to view as HTML?

Last edited by impeham; 2012-11-11 at 20:22.
 

The Following User Says Thank You to impeham For This Useful Post:
Posts: 669 | Thanked: 433 times | Joined on May 2010
#9
I had an idea of how to be able to view the emails found in the search process of the script using the built in email application -here is what I did:

Using the email application I've created a new folder - "Test", then I moved one of my emails from the inbox to this folder. Now I could see that the following folder was created in the FS: "/home/user/.modest/local_folders/Test".

My moved email file was found at: "/home/user/.modest/local_folders/Test/cur".

Next step - I copied the emails I found with your search script into "/home/user/.modest/local_folders/Test/cur" and tried to see them with the built in email application - I could still only see the email I had moved before.

Checking further, I've noticed that when a message Is moved to this folder, another file is being updated:

/home/user/.modest/local_folders/Test.ev-summary.mmap

It seems that this file holds the list of email files (with their subject etc.) in some binary format.

I replaced the file of the email I moved at first with another email file and tried to open it with the email application - It was successful - even though the "Subject" of the email was the old one (the details were stored in "/home/user/.modest/local_folders/Test.ev-summary.mmap"), its content was of the newly copied email file.

If there was a way to update the "Test.ev-summary.mmap" and add to it new files being added to "/home/user/.modest/local_folders/Test/cur" (the ones found in the search process), we could view these emails at the end of the search very nicely with the built in application including HTML content and pictures.

Thoughts about progressing with this are very welcome.

Last edited by impeham; 2012-11-11 at 21:57.
 

The Following User Says Thank You to impeham For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 09:36.