From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id ME3WFWJ72GH8agAAgWs5BA (envelope-from ) for ; Fri, 07 Jan 2022 18:41:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wJgWE2J72GFTqgAA9RJhRA (envelope-from ) for ; Fri, 07 Jan 2022 18:41:54 +0100 Received: from mail.notmuchmail.org (yantan.tethera.net [IPv6:2a01:4f9:c011:7a79::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5C7C7367E4 for ; Fri, 7 Jan 2022 18:41:53 +0100 (CET) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id B22F35F713; Fri, 7 Jan 2022 17:41:46 +0000 (UTC) X-Greylist: delayed 528 seconds by postgrey-1.36 at yantan; Fri, 07 Jan 2022 17:41:43 UTC Received: from arlo.cworth.org (arlo.cworth.org [50.126.95.6]) by mail.notmuchmail.org (Postfix) with ESMTPS id CEBCB5F6CB for ; Fri, 7 Jan 2022 17:41:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cworth.org; s=mail; t=1641576773; bh=KZ2b8OItYc15RIqpkcnA3hXZ70tnT0slbS1GMKbJm48=; h=To:Subject:In-Reply-To:References:From:Date:From; b=tqeMrHADsfr7TVmoIqf/gjg6qqRdMC/29vtA6pLcli/gygQF5riOZlwD019+FNc07 NkmASGOkLzi0GSehUhHjhaesKuctrANdgDTVwabJv/lN0+8LXvfj54rt5av33B1Hfl Bya1V/33wHFEaLa/6XPXqBLq7pJreckw9Nrii+C0G1nB4mBuyM5TVxg1V86KCRrL+q MDx8vZKLJl3MZsRxYjzzPORAaNQIq774VJ7chi7MQiQeEPzx7PAB9f+0vJ9I7Euiuv 2YqDb+fWo1rmUdc3fpgH14eq7EhviZ44NOyAPUezGFfDLb54WnOh/WoMgdqPhQ93g9 z/lsYOj1lbBrA== Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 50F1C6DE0AFD for ; Fri, 7 Jan 2022 09:32:53 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IgrqPlSuZ7FG; Fri, 7 Jan 2022 09:32:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cworth.org; s=mail; t=1641576772; bh=KZ2b8OItYc15RIqpkcnA3hXZ70tnT0slbS1GMKbJm48=; h=To:Subject:In-Reply-To:References:From:Date:From; b=tImHMM7eoEG7mdK6arnpm9TaDTlwZsbYkn9AKlFBmVFBHuQA3NJqp9W5LYGf5CUwa e20IFdNjlu+igwcgagmKJUAPAM3V+2g26Pdrzu+yzwbc/1A9z4/QUuQwcVdk33Bhos 1Kk3xi5KU1jKdAUHh4BtoW+WxoZ1okEypCUBuIaaZTyPB3I+G8PehMIlEcj/bFqLDC WsLhCPtYjHllxz86Jqfms4lrPZKWePhpIR63pOwyJmvdL8XUABHRubcECqQBvdSf9Q cwpNPHSslbTboXKTDNRe0I3kJ/xnACujrg2Cv/5kqB23uL66y4u4WQ8IIjYnH2r3xh /hcTrFNdkrUvw== Received: from wondoo.home.cworth.org (unknown [10.0.0.161]) (Authenticated sender: cworth) by arlo.cworth.org (Postfix) with ESMTPSA id A70BD6DE025B; Fri, 7 Jan 2022 09:32:52 -0800 (PST) Received: from wondoo (localhost [IPv6:::1]) by wondoo.home.cworth.org (Postfix) with ESMTPS id 877691FE15CF; Fri, 7 Jan 2022 09:32:52 -0800 (PST) To: signmeup1337@cock.li, notmuch@notmuchmail.org Subject: Re: Statistics about senders with notmuch possible? In-Reply-To: <9fcfcd939fe28bc87fbdb3bb25323fd1@cock.li> References: <9fcfcd939fe28bc87fbdb3bb25323fd1@cock.li> Sender: cworth@cworth.org From: Carl Worth Date: Fri, 07 Jan 2022 09:32:43 -0800 Message-ID: <87o84n5u4k.fsf@wondoo.home.cworth.org> MIME-Version: 1.0 Message-ID-Hash: 3PIBUM2M7G3Z5AB266YI6FCF4DSNJXN2 X-Message-ID-Hash: 3PIBUM2M7G3Z5AB266YI6FCF4DSNJXN2 X-MailFrom: cworth@cworth.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============0309886774024562374==" X-Migadu-Flow: FLOW_IN X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1641577314; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-owner:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=wcDIvk8Z4Nc1Pqkdc/fRjWe3UMIxlSkYURfGzPIDynU=; b=uiSrG/4Ntz2q3F4GSxREJZ6WjDkvkOYKUog+kWVUvTvncRlUZwZbFmLB2vVkhKvZ1hhHPz iQkQBxbF/QokgTXuD97nM8pqgJzK80Y6CcxY77yNGA5nCLCTMCc8wTRDVdvLaejFoR5g+c SB+Lion0OswP4WjxE6ls+E3czNWrn+XXbtUfs2wLFhnBNqvMzXlsvE3nX7fBeGz+ZYhw0Y gFXkHtdFarJQMhB95kcIKsIdOKnq4qSam0FqKIcmbaNrpxCYyfuYiPWBA8ZIpqBfW37cOa sUxnKiN0FI59qIV+79IwD2wGMguC3HadCxJcbLiozS0CVCI88TaB9nUEFnHrtQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1641577314; a=rsa-sha256; cv=none; b=SjSDftoR/dPFmmhnSr6lZ1FL4dwhrSnswD0Xlad/qRH+yzEthpyMb8ThP9C/SgXXggt/19 XNI0TEudHdcihysEpIFn7kRosTvS+2pQLgKleFWS/lcUXpaVZx9R803JL4d1SYR9g7RvKm FZGgBLG5cx0b92/C6ch0LiroCwPUJFpy4uObTU6AFun72Zo9CrGHxBm90fS91HapSECLP2 M4wKyA2XyfUBQtI6Lu7sKwf3uIZY/9EztSpRjwoaymKibDryvGJCPge/HpGsVFNmPgjjdy 1tpXUQDXU4PTVxo4ordcsoxmdEDs/7jk5VjkmbnymznQnSH+KfoATzdGHTMBoA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=cworth.org header.s=mail header.b=tqeMrHAD; dkim=fail ("body hash did not verify") header.d=cworth.org header.s=mail header.b=tImHMM7e; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -2.88 Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=cworth.org header.s=mail header.b=tqeMrHAD; dkim=fail ("body hash did not verify") header.d=cworth.org header.s=mail header.b=tImHMM7e; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2a01:4f9:c011:7a79::1 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: 5C7C7367E4 X-Spam-Score: -2.88 X-Migadu-Scanner: scn0.migadu.com X-TUID: 4K7y7/GDnBmX --===============0309886774024562374== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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=3Dsender --output=3Daddress '*' 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=3Dsender --output=3Daddress '*'); do count=3D$(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, =2DCarl --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEzvjdyAGcpm1OMJTzYAIzup5U3GEFAmHYeTsACgkQYAIzup5U 3GFHaxAApoTsNVcrSEGn4A24EKm1EMLlg7MrSVdDeeMpYMRNcKdyNggWZx1zfgBF 1Pp2HajlT9eLCVzicBNzIY9Y33rBq81ddtlODn1L6jhSaV7yffvWZBtsyu0j+RF8 LlW/mrLcpZlwyMeEcQM93x1vUzZvfqUbV3A5NUPBxKrhpp87B8nKybBS7Kt+W7jV v/L7xSstWwCjbr/xAbJ+YrV9WYutRaRJzQPVvw3Dyo0fsEcq2uHszeu2xn7gFO4h YwnSsbbowKGuOtypH5qJdcrkmG2Gn42M6Uxu6d8RZ80qrP+cocc5+WpP2u8OkMg9 CfaxOLVbQABMpr6wzVyFI33nEM8lVMsp1TA/Ue9VRVD2HFYlOmu6Jl7HM8iykpOP djochyyEhwGCETHQxv/ff/sMVTYOyws8b1kobh7wtb1qj9zeZhFzy5VGQUzkqzS+ fwo5QGcRVxmX0SZOjn+yON3uNhQwQ5ORKoZYZH7paX3T2GgjcRaDUiubTMnf+EdQ P+w1Ac+pAg/A00ldy2/JyOblhH7ifs8DEDEfKHlopslRfKT+Gpzrp5eE75v2AfwW TTQPX4e/BSlIDxsp86uqQ0g+FiZ/TivyUGtaQoy31aWuxDNpu5fU2KUTV9imZp2E +6Sl44srxwhC0JMEslnGJwSbKHlRKqeOlwIRD6IT91Kj6sG3D2E= =SdDV -----END PGP SIGNATURE----- --=-=-=-- --===============0309886774024562374== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============0309886774024562374==--