reply_all_warn.lua
1-- reply_all_warn.lua
2-- Warns when sending to many recipients (possible accidental reply-all).
3
4local matcha = require("matcha")
5
6local threshold = 5
7
8matcha.on("email_send_before", function(email)
9 local count = 0
10 for _ in email.to:gmatch("[^,]+") do
11 count = count + 1
12 end
13 for _ in email.cc:gmatch("[^,]+") do
14 count = count + 1
15 end
16 if count >= threshold then
17 matcha.notify("Heads up: sending to " .. count .. " recipients", 3)
18 end
19end)