Two questions regarding header display

raf mutt at raf.org
Sun Jun 5 05:51:36 UTC 2022


On Sun, Jun 05, 2022 at 12:06:52AM -0400, Jason Franklin <jason at oneway.dev> wrote:

> Greetings:
> 
> I have two questions regarding header display...
> 
> First, can the pager display header names in bold if the terminal
> supports it?
> 
> Second some senders have weird capitalization of headers. Is it possible
> to display some canonical representation of any given standard header?
> 
> To clarify, if the header is sent as "reply-to", I would like to always
> see "Reply-To" in the pager.
> 
> Thanks!
> 
> -- 
> Jason

Hi, I don't know about the first part, but the second part
could be done if procmail or similar is used for local
delivery, and it passes incoming messages through a filter
to "correct" the headers to your liking. But it might
be a hassle if you aren't already using procmail.

~/.procmailrc:

  :0 fw
  | /home/me/bin/fix-mail-headers-filter

/home/me/bin/fix-mail-headers-filter:

  #!/usr/bin/env perl
  use warnings;
  use strict;
  # Modify headers if needed (e.g. "reply-to:" to "Reply-To:")
  while (<>)
  {
    # Skip to the following trivial loop after headers
    print, last if /^$/;
    # Replace lowercase at start of word before colon with uppercase
    s/^([^:]*)\b([a-z])/$1\U$2/ while /^[^:]*\b[a-z]/;
    print;
  }
  # Jut print the rest unchanged
  print while (<>);

The above was barely tested. Don't use it without testing it on
lots of existing mail (one message at a time - see formail(1))
until you are sure that it works. And note that it doesn't
convert any uppercase to lowercase, only the other way around.

cheers,
raf



More information about the Mutt-users mailing list