Drop subject:LiveTrack from the Apps Script's Gmail search, it finds nothing
Documented as matching regardless of language, on the assumption
Gmail's subject: operator does a substring match — empirically false
against a real, currently-arriving LiveTrack email whose subject does
contain the word ("Sledujte LiveTrack používateľa ...", confirmed
2026-09-20): with the filter, the search returned zero threads;
removing it and rerunning found the email immediately. Left out
entirely rather than replaced — from:noreply@garmin.com plus the
session-link regex already narrows this down to real LiveTrack emails
with something usable in them.
This commit is contained in:
1 parent
5d86cb1d04
commit
8eada07869
1 file changed
+9
-4
@@ -212,7 +212,7 @@ const PROCESSED_LABEL = "livetrack-processed";
|
|||||||
|
|
||||||
function checkLiveTrackEmail() {
|
function checkLiveTrackEmail() {
|
||||||
const label = GmailApp.getUserLabelByName(PROCESSED_LABEL) || GmailApp.createLabel(PROCESSED_LABEL);
|
const label = GmailApp.getUserLabelByName(PROCESSED_LABEL) || GmailApp.createLabel(PROCESSED_LABEL);
|
||||||
const threads = GmailApp.search(`from:noreply@garmin.com subject:LiveTrack -label:${PROCESSED_LABEL}`);
|
const threads = GmailApp.search(`from:noreply@garmin.com -label:${PROCESSED_LABEL}`);
|
||||||
|
|
||||||
threads.forEach(thread => {
|
threads.forEach(thread => {
|
||||||
// getBody() (raw HTML), not getPlainBody(): the email has no text/plain
|
// getBody() (raw HTML), not getPlainBody(): the email has no text/plain
|
||||||
@@ -235,9 +235,14 @@ function checkLiveTrackEmail() {
|
|||||||
|
|
||||||
The Gmail label (rather than marking the message read/unread) tracks which
|
The Gmail label (rather than marking the message read/unread) tracks which
|
||||||
threads are already handled without touching the user's own inbox state.
|
threads are already handled without touching the user's own inbox state.
|
||||||
`subject:LiveTrack` matches regardless of the account's language — Garmin
|
No `subject:LiveTrack` filter on the search — despite Gmail's own
|
||||||
keeps "LiveTrack" as-is in the subject even in a localized
|
substring-match documentation for `subject:`, that filter empirically
|
||||||
("Sledujte LiveTrack používateľa ...") one.
|
returned zero threads against a real, currently-arriving LiveTrack email
|
||||||
|
whose subject does contain the word ("Sledujte LiveTrack používateľa
|
||||||
|
...", confirmed 2026-09-20), so it's left out entirely — the regex match
|
||||||
|
below is what actually narrows this down to real LiveTrack emails with a
|
||||||
|
usable session link, `from:noreply@garmin.com` alone is deliberately
|
||||||
|
broad.
|
||||||
|
|
||||||
Set the trigger from the editor: clock icon on the left (Triggers) → *Add
|
Set the trigger from the editor: clock icon on the left (Triggers) → *Add
|
||||||
Trigger* → function `checkLiveTrackEmail`, time-driven, "Minutes timer",
|
Trigger* → function `checkLiveTrackEmail`, time-driven, "Minutes timer",
|
||||||
|
|||||||
Reference in new issue
Block a user