emailgmailscheduled-tasksgmail-apiemail-headers

As a recipient, is it possible to detect if an email was sent via Gmail's "Schedule Send" vs. "Send"?


Just curious if the email headers are marked by Gmail to denote if the email was scheduled vs sent right away.


Solution

  • When I tested this myself, I couldn't find any additional headers or any additional parameters in the headers. When you schedule an email, though, Gmail sets the Date header to the scheduled time. Since you can schedule emails only with the precision of minutes but not seconds, you know for sure that the email wasn't scheduled if the time when the email was sent includes seconds. In my experiment:

    Date: Sat, 13 Feb 2021 10:17:41 +0100 <- non-scheduled
    Date: Sat, 13 Feb 2021 10:20:00 +0100 <- scheduled
    

    To calculate the probability that the email was scheduled when the seconds are zero, we lack the base rate of how many emails are scheduled. It's a classic application of Bayes' theorem:

    P(scheduled | zero) = P(zero | scheduled) * P(scheduled) / (P(zero | scheduled) * P(scheduled) + P(zero | non-scheduled) * P(non-scheduled))

    where:

    If you set X to to your best estimate of how many emails are scheduled, for example 1 / 1000, you get the probability that an email was indeed scheduled if the seconds are zero as P = X / (X + 1/60 * (1 - X)). With X = 1 / 1000, P = 5.6%. Let me know if I made any mistakes.

    PS: The headers include which Gmail server sent the message. It might be that Google uses different servers for scheduled and non-scheduled messages. One would have to send way more emails, though, to figure this out.