Home > Software engineering >  using gmail api to filter out emails from some format
using gmail api to filter out emails from some format

Time:09-30

I am trying out gmail api and having hard time with filters. I want to exclude some emails, something like filtering out emails sent to "[email protected]", having no luck finding anything in gmail api docs.

I am using nodejs client and constructing query like this.

    const result = await gmail.users.messages.list({
      auth: oauth2Client,
      userId: "me",
      q: `in:sent after:2021/09/01`
    })

does gmail api have something like not:[email protected] or something like exclude:[email protected] or is this not possible at all?

CodePudding user response:

Could you append -keyword at query

const result = await gmail.users.messages.list({
      auth: oauth2Client,
      userId: "me",
      q: `in:sent after:2021/09/01 [email protected]`
    });
  • Related