subject_length_warn.lua

 1-- subject_length_warn.lua
 2-- Warns when your subject line is getting too long.
 3-- Most email clients truncate subjects beyond ~60 characters.
 4
 5local matcha = require("matcha")
 6
 7matcha.on("composer_updated", function(state)
 8    local len = #state.subject
 9    if len > 78 then
10        matcha.set_status("composer", "Subject too long (" .. len .. " chars)")
11    elseif len > 60 then
12        matcha.set_status("composer", "Subject may truncate (" .. len .. " chars)")
13    end
14end)