domain_filter.lua
1-- domain_filter.lua
2-- Highlights emails from specific domains with a notification.
3-- Useful for filtering work vs. personal emails.
4
5local matcha = require("matcha")
6
7local watched_domains = {
8 "company.com",
9 "work.org",
10}
11
12matcha.on("email_received", function(email)
13 for _, domain in ipairs(watched_domains) do
14 if email.from:match("@" .. domain:gsub("%.", "%%.") .. "$") then
15 matcha.notify("Work email: " .. email.subject, 2)
16 return
17 end
18 end
19end)