emailgoogle-apigmailgmail-apigmail-imap

As sender, using API or headers, is it possible to detect if an email was sent using Gmail's “Schedule Send”?


What I need is to detect if an email is sent using the "Schedule Send" tool in Gmail[1], via API or reading email headers (on the sender side/inbox).

Exactly the opposite scenario than here: As a recipient, is it possible to detect if an email was sent via Gmail's "Schedule Send" vs. "Send"?

In my experience, a scheduled email looks like a draft or a received email (with your address in the "from") for the API, and then, it raises an event when it is sent that adds the "SENT" label to the email. Is there a way to know that those are outgoing emails before the event?

[1] https://support.google.com/mail/answer/9214606?co=GENIE.Platform%3DDesktop&hl=en


Solution

  • Issue:

    By default you cannot detect that. The message headers don't include any information related to that, and the API's Message resource doesn't have any field which can clarify that.

    Also, even though Scheduled is a reserved system label and so labels cannot be created with that name:

    enter image description here

    Scheduled is not a label which can be found in the API (e.g. by calling users.labels.list), so you cannot filter messages (e.g. using users.messages.list) according to whether they have this label.

    Workaround:

    enter image description here

    You can then list the messages that contain this label.

    enter image description here

    File a Feature Request:

    I'd suggest you to file a Feature Request in the corresponding Issue Tracker's component, so that scheduled messages can be programmatically listed through Gmail API.