Search program that can find an E-Mail with an exact Date: match

Chris Green cl at isbd.net
Tue Nov 30 11:00:41 UTC 2021


On Tue, Nov 30, 2021 at 11:20:10AM +0100, Bastian wrote:
> On 29Nov21 17:36+0000, Chris Green wrote:
> > On Mon, Nov 29, 2021 at 09:45:17AM -0500, Ofer Inbar wrote:
> > But does it do it recursively down a hierarchy of folders?  That's
> > what I need.
> 
> Afaik, no. Mutt search/limits work on the current opened mailbox.
> 
> What you are trying to achieve is from my perspective a corner case and 
> make me a bit curious about it. Currently, I cannot think of a situation 
> where the Date Header is the only piece of information available to 
> search for a specific email; also in a strict string and not like on Tue 
> three weeks ago. Keep in mind, the Date field is set by the sender [0]. 
> I am not sure which instance actually adds it, mutt (as MUA) or sendmail 
> (as MTA).
> 
>   0: https://datatracker.ietf.org/doc/html/rfc2822#section-3.6.1
> 
> Anyways, just because I cannot imagine the situation, does not mean 
> there isn't one. From what I understood so far, I would have solved that 
> with `grep -r`, too. Mutt and the mail indexers I am familiar with do 
> not seem to provide what you are asking for.
> 
Yes, it is rather an odd requirement and driven by history, a typical
"if I did that now I wouldn't do it that way"! :-)

I have a personal wiki (Dokuwiki) where I keep lots of information,
mostly for my own use but also for family and friends.

A long time ago (2009/2010) we were buying a boat and I had long,
complex E-Mail conversations with the boat hire company in France who
were selling the boat.  I wrote a Doukwiki plugin to show the E-mails
in Dokuwiki, it used a ZendFramework library and the E-Mails were
referenced by folder and the Date: header as that was short and unique.

The ZendFramework has gone away to become Laminas and the PHP version
has upped a long way since 2010.  I didn't want to lose the ability to
see these conversations still so I was looking for a quick and dirty
way to do it.

As I said I've found mblaze which is in the Ubuntu repositories and I
have a bash script:-

    dir="/home/chris/mail/folder/$1"
    mdirs "$dir" | mlist | magrep 'Date:'"$2" | mshow

... which, given a sub-folder and a date/time string, outputs the body
of the E-Mail.  This is called using popen() from my Dokuwiki plugin,
and it works!  The 'mshow' in particular simplifies the Dokuwiki PHP
code considerably because it does all the nasty stuff of parsing the
E-Mail and working out what is most likely the wanted text.

I don't have to change the Dokuwiki pages at all as they were already
set up to call the plugin code with folder name and Date: string as
parameters.

(We didn't buy the boat by the way, the survey showed up problems, we
bought a much cheaper privately owned boat a few months later)

-- 
Chris Green


More information about the Mutt-users mailing list