attachment_reminder.lua

 1-- attachment_reminder.lua
 2-- Warns if your email body mentions an attachment but you might have
 3-- forgotten to attach it. Checks common phrases before sending.
 4
 5local matcha = require("matcha")
 6
 7local phrases = {
 8    "attach",
 9    "attached",
10    "attachment",
11    "enclosed",
12    "find attached",
13    "see attached",
14    "i've attached",
15}
16
17matcha.on("composer_updated", function(state)
18    local body = state.body:lower()
19    for _, phrase in ipairs(phrases) do
20        if body:find(phrase, 1, true) then
21            matcha.set_status("composer", "Don't forget the attachment!")
22            return
23        end
24    end
25end)