Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search by multiple Message-Id's #903

Open
M1z23R opened this issue Jun 12, 2023 · 1 comment
Open

Search by multiple Message-Id's #903

M1z23R opened this issue Jun 12, 2023 · 1 comment

Comments

@M1z23R
Copy link

M1z23R commented Jun 12, 2023

I am working on groups of sent emails, so I want to be able to find all replies to those sent messages. I know I can query by in-reply-to and references, I also know, I can chain multiple OR*s, but I am not sure what the limit would be, and I don't want to bombard the mail server with a lot of data just for the search query since - if I am not mistaking, those queries are executed on server and not client side - correct me if I am wrong.
Basically, what I am looking for is a way to pass an array of message-id's just like passing array of arrays of uid's.

@M1z23R
Copy link
Author

M1z23R commented Jun 12, 2023

I just tried with 500 emails, and to be honest, it doesn't seem that slow or anything. I'd still like to hear some other thoughts, but here is how I did it in case someone else needs it:

var searchCriteria: any = [["HEADER", "IN-REPLY-TO", messageIds[0]]];
if (messageIds.length > 1) {
  let indx = 1;
  while (indx !== messageIds.length - 1) {
    searchCriteria = [
      [
        "OR",
        ["HEADER", "IN-REPLY-TO", messageIds[indx]],
        ...searchCriteria,
      ],
    ];
    indx++;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant