filters: allow matching any email header

In addition of the common headers (subject, to, from, cc), allow
matching arbitrary email headers in filters. E.g.:

  x-bugzilla-severity,critical=tput setaf 1; cat;tput sgr0

Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Robin Jarry 2021-10-25 18:13:24 +02:00
parent 1a75906bcb
commit fea57839fb
1 changed files with 2 additions and 0 deletions

View File

@ -502,6 +502,8 @@ func NewPartViewer(acct *AccountView, conf *config.AercConfig,
header = format.FormatAddresses(info.Envelope.To)
case "cc":
header = format.FormatAddresses(info.Envelope.Cc)
default:
header = msg.MessageInfo().RFC822Headers.Get(f.Header)
}
if f.Regex.Match([]byte(header)) {
filter = exec.Command("sh", "-c", f.Command)