unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: NeilBrown <neil@brown.name>
To: Tomi Ollila <tomi.ollila@iki.fi>,
	David Bremner <david@tethera.net>,
	Firmin Martin <firminmartin24@gmail.com>,
	notmuch@notmuchmail.org
Subject: Re: Query emails sent to undisclosed-recipients
Date: Thu, 15 Apr 2021 12:46:02 +1000	[thread overview]
Message-ID: <87wnt42rkl.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <m2mtut63k3.fsf@guru.guru-group.fi>


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

On Tue, Mar 23 2021, Tomi Ollila wrote:

> On Tue, Mar 23 2021, David Bremner wrote:
>
>> Tomi Ollila <tomi.ollila@iki.fi> writes:
>>
>>> On Tue, Mar 23 2021, Firmin Martin wrote:
>>>
>>>> Hi,
>>>>
>>>> I have emails whose the "To" field is undisclosed recipients. In JSON:
>>>>
>>>> ```
>>>> "To": "undisclosed-recipients: ;"
>>>> ```
>>>>
>>>> I would want to tag such email as spam, but I can't query them
>>>> using 
>>>>
>>>> ```
>>>>  notmuch show --format=json to:"undisclosed-recipients: ;"
>>>> ```
>>>>
>>>> or any variation (regex etc.).
>>>>
>>>> This question has already been addressed in 2013 [1]. Are there any plan
>>>> to implement this feature or available workaround ?
>>>
>>> Tried. many things. did not work. notmuch-search-terms(7) tells
>>>
>>>      to:<name-or-address>
>>>
>>> (so no regex syntax...)
>>>
>>> I don't know why that doesn't work. IIRC no plan, but patches welcome >;D
>>
>> The (light) technical background is that regex syntax in notmuch
>> requires value slots, and someone (TM) would need to evaluate how much
>> adding a value slot for to: would cost in terms of database size / speed
>> of queries.
>>
>> I think there's a separate question about address groups being ignored,
>> discussed in the linked thread.
>
> But the question if why doesn't to:undisclosed-recipients:
> or to:undisclosed-recipients work

Because "undisclosed-recipient:" is not an address or a comment (in
RFC822 / RFC5322 syntax).  It is a label (a name for a group of addresses).
It is not syntactically valid to have an empty "to:" field, or to have
no "to:" field.  The only valid syntax which doesn't actually give any
address is "label:;".

These messages don't actually have any "to" address.
So
   notmuch search "not to:*"
should work... except that it doesn't.

    notmuch search --output=files "not (to:a* OR to:b* OR to:c* OR to:d* \
    OR to:e* OR to:f* OR to:g* OR to:h* OR  to:i* OR to:j* OR to:k* \
    OR \to:l* OR to:m* OR to:n* OR to:o* OR to:p* OR to:q* OR to:r* \
    OR to:s* OR to:t* OR to:u* OR to:v* OR to:w* OR to:x* OR to:y* OR to:z*)"

does work (as long as no addressed start with a non-alpha character).

I piped the above in
    xargs grep -i '^to:' | grep -v -i ': *;'

Some of the matches had an empty 'to:' which is syntactically invalid.
Others had "<>" as the address.  I don't think this is legal, but I've
seen it used in Return-path: a lot.  RFC5322 doesn't mention it.
The rest was in the noise.

NeilBrown

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

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



      parent reply	other threads:[~2021-04-15  3:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-23 13:11 Query emails sent to undisclosed-recipients Firmin Martin
2021-03-23 18:33 ` Tomi Ollila
2021-03-23 19:26   ` David Bremner
2021-03-23 20:03     ` Tomi Ollila
2021-03-24  0:24       ` [PATCH] test: add known broken test for indexing RFC822 group names David Bremner
2021-03-24  0:37         ` David Bremner
2021-06-07 23:33         ` David Bremner
2021-04-15  2:46       ` NeilBrown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnt42rkl.fsf@notabene.neil.brown.name \
    --to=neil@brown.name \
    --cc=david@tethera.net \
    --cc=firminmartin24@gmail.com \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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).