With the recent onslaught of updates and CVEs, I’ve found it ever more important to protect my time from external notifications (and an unhelpfully reinforced learning that I need respond to everything immediately). To assist with this, I’ve set up a custom Fastmail Sieve rule that automatically snoozes all but a handful of out-of-hours emails until 9am the next working day, ensuring I’m not sucked back in by a GitHub message or marketing mail that I’ve thus-far failed to unsubscribe from.

Since it’s not immediately obvious this is possible using Fastmail (it’s not available through the UI), I thought I’d share it here in case it’s helpful to others:

set "offset" "-1000"
set "tz" "Pacific/Honolulu"

if allof (
  not address :is ["to", "cc", "bcc"] "[email protected]",
  anyof (
    currentdate :zone "${offset}" "weekday" ["0", "6"],
    currentdate :zone "${offset}" :value "lt" :comparator "i,ascii-numeric" "hour" "9",
    currentdate :zone "${offset}" :value "ge" :comparator "i,ascii-numeric" "hour" "17"
  )
) {
  snooze :addflags "$new" :tzid "${tz}" :weekdays ["1", "2", "3", "4", "5"] ["09:00:00"];
  stop;
}

You can add this and other custom rules by following the ‘Edit custom Sieve code’ link at the bottom of the ‘Filters & Rules’ settings page—I added mine after everything else to ensure it doesn’t stop any other rules working.