Mail::...Header(3pm)

πŸ’– Mail::...Header β€” the MIMEHeader glow-up πŸ’–

okay bestie, gather round, because this is the Mail::SpamAssassin::Plugin::MIMEHeader page and it's literally the plugin that lets you write regexp rules against the MIME headers in a message. yes. the headers. the MIME ones. we're doing regexp tests against them. slay.


✨ NAME ✨

MIMEHeader β€” perform regexp tests against MIME headers πŸ¦‹


✨ SYNOPSIS ✨

loadplugin    Mail::SpamAssassin::Plugin::MIMEHeader
mimeheader    NAME_OF_RULE    Content-Id =~ /foo/

that's it. that's the whole vibe. chef's kiss πŸ’…


✨ DESCRIPTION ✨

so this plugin is the one that makes it possible to write regexp rules that get aimed at the MIME headers in the message. like, the plugin exists, the rules go in, the headers get tested. periodt. ✨


✨ RULE DEFINITIONS AND PRIVILEGED SETTINGS ✨

🌸 mimeheader NAME_OF_RULE Header-Name =~ /pattern/modifiers

this is how you specify a rule, bestie. break it down:

  • NAME_OF_RULE β€” the name of the rule you're using, iykyk
  • Header-Name β€” the name of the MIME header you want to check πŸ‘€
  • /pattern/modifiers β€” the Perl regular expression that gets matched against that header
🚨 important one, no cap: if the message has multiple parts, each header gets checked against the pattern separately. so if multiple parts each have a Content-Type header, every single header's value gets tested individually, as its own separate string. not combined, not vibing together. individually. πŸ’€

header names are considered case-insensitive β€” yes, we love a lowercase-friendly queen πŸ‘‘

and about the values themselves: normally the header values get cleaned up a little. for example, the whitespace around the newline character in "folded" headers gets replaced with a single space. but if you want the raw thing β€” the raw, undecoded value, pristine whitespace and all β€” just append :raw to the header name. do that. she's unedited, she's unfiltered, she's giving main character energy 🌈


🌸 tflags NAME_OF_RULE range=x-y

this one lets you match only from specific MIME parts, and the parts are indexed in the order they are parsed. so:

  • Part 1 = main message headers πŸ‘‘
  • Part 2 = next part, etc. etc. etc.

so what does the range actually look like in practice? here you go:

range=1    (match only main headers, not any subparts)
range=2-   (match any subparts, but not the main headers)
range=-3   (match only first three parts, including main headers)
range=2-3  (match only first two subparts)

look at that range syntax eating. range=2-3 giving "only first two subparts" energy ✨


🌸 tflags NAME_OF_RULE concat

okay this one is the >✨glue✨< of the whole operation. it concatenates all headers from all mime parts (with a possible range applied, so yes, ranges still vibe) into a single string for matching.

why is that iconic? because it lets you match headers across multiple parts with a single regex. normally, though, the pattern gets tested individually for the different mime parts. so concat is the one that says "actually, bestie, hold hands, we're doing this together" 🫢


🌈 sign-off 🌈

and that's the whole page, bestie β€” you're officially MIME-header-pilled. this masterpiece of documentation is served up as part of the User Contributed Perl Documentation, written against perl v5.40.1, dated 2026-07-23, and honestly? iconic behavior. go forth and match those headers. mwah πŸ’–πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Άβœ¨

πŸ“¦ where this page comes from