unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Statistics about senders with notmuch possible?
@ 2021-12-27 22:57 signmeup1337
  2021-12-28 10:47 ` Michael J Gruber
  2022-01-07 17:32 ` Carl Worth
  0 siblings, 2 replies; 3+ messages in thread
From: signmeup1337 @ 2021-12-27 22:57 UTC (permalink / raw)
  To: notmuch

I would like to create some kind of statistics to see from which sender 
I've got the most emails, having something like a TOP 10 list.

In the end of every year I delete all my emails, which are not marked as 
archive and this year I got over 4.000 and most of them are just 
notifications (like ebay, if someone buys something). But I really would 
like to figure out where else the most mails are coming from to avoid 
them in the next year.

Is something like this possible with notmuch?

Thanks a lot for you help in advance :)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Statistics about senders with notmuch possible?
  2021-12-27 22:57 Statistics about senders with notmuch possible? signmeup1337
@ 2021-12-28 10:47 ` Michael J Gruber
  2022-01-07 17:32 ` Carl Worth
  1 sibling, 0 replies; 3+ messages in thread
From: Michael J Gruber @ 2021-12-28 10:47 UTC (permalink / raw)
  To: notmuch

signmeup1337@cock.li venit, vidit, dixit 2021-12-27 23:57:18:
> I would like to create some kind of statistics to see from which sender 
> I've got the most emails, having something like a TOP 10 list.
> 
> In the end of every year I delete all my emails, which are not marked as 
> archive and this year I got over 4.000 and most of them are just 
> notifications (like ebay, if someone buys something). But I really would 
> like to figure out where else the most mails are coming from to avoid 
> them in the next year.
> 
> Is something like this possible with notmuch?

`notmuch address` should provide everything you want (bar the sorting):

`notmuch address --output=count --deduplicate=address date:2021 | sort -nr | head -n 10`

Leave out the dedup option if you want to distinguish senders by the
full mailbox address. And, of course, amend the query any way you want.
That's the beauty of notmuch's modular approach.

Cheers
Michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Statistics about senders with notmuch possible?
  2021-12-27 22:57 Statistics about senders with notmuch possible? signmeup1337
  2021-12-28 10:47 ` Michael J Gruber
@ 2022-01-07 17:32 ` Carl Worth
  1 sibling, 0 replies; 3+ messages in thread
From: Carl Worth @ 2022-01-07 17:32 UTC (permalink / raw)
  To: signmeup1337, notmuch


[-- Attachment #1.1: Type: text/plain, Size: 2159 bytes --]

On Mon, Dec 27 2021, signmeup wrote:
> I would like to create some kind of statistics to see from which sender
> I've got the most emails, having something like a TOP 10 list.
>
[ 4 more citation lines. Click/Enter to show. ]
> In the end of every year I delete all my emails, which are not marked as
> archive and this year I got over 4.000 and most of them are just
> notifications (like ebay, if someone buys something). But I really would
> like to figure out where else the most mails are coming from to avoid
> them in the next year.
>
> Is something like this possible with notmuch?

Yes, it's definitely possible. Being able to script up operations like
this that act on your email store has always been a primary design goal
of notmuch, so this isn't actually hard to do.

Given any sender address you can ask notmuch to count the emails sent
from that address. Such as:

        notmuch count from:cworth@cworth.org

And you can also use notmuch to generate a list of all sender email
addresses across all of your email, with:

        notmuch address --output=sender --output=address '*'

So you can take the output from that second command and then run the
first command with email address in the output.

Doing that all combined, and the sorting the result might look something
like the following (assuming you are using bash as your shell):

        for sender in $(notmuch address --output=sender --output=address
'*'); do count=$(notmuch count from:$sender); echo "$count $sender"; done |
sort -n

If you wanted to run this on a subset of your email, just change the '*'
to a search specification for the messages you want to match, (where '*'
will match all messages).

And of course, this is running a separate notmuch search for every
sender email address you have in all of your emails, (not only the top
10 like you really want), so this could take some time if you have a lot
of messages. I just tested with a small subset of my own email messages
(the 21k+ messages I have matching 'subject:notmuch') and the above
script took about 30 seconds on my laptop.

I hope that helps,

-Carl

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-07 17:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-27 22:57 Statistics about senders with notmuch possible? signmeup1337
2021-12-28 10:47 ` Michael J Gruber
2022-01-07 17:32 ` Carl Worth

Code repositories for project(s) associated with this inbox:

	notmuch.git.git (no URL configured)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).