When I view a message in the pager mutt displays the time in the Date header in UTC rather than my local time zone. The index view displays the local time correctly. I found this old mailing list post that describes how to get the local time to display in the status bar at the bottom of the screen, but this still doesn't "fix" the time in the Date header at the top of the screen. Is there any way to get the pager to convert the Date header time to local time?
Bash – How to configure mutt to display the date header in the local time zone in the pager
bashconfigurationemailmuttshell-script
Best Answer
In your
.muttrc
add the following line:This will change the
Date:
header in the message (for display only) to your local timezone if the header contained a valid RFC formatted date. If the provided date format was incorrect (we are dealing with untrusted user input after all) it will be preserved. To combat a possible attempt to inject the shell code through the header thesed
pattern implements a whitelist based on RFC 5322 (this RFC defines the format of theDate:
field).Note that
mutt
limits the command line to be no more than 255 character long, hence I optimised the originalsed
command that had stricter whitelist to fit into 255 bytes. If you plan to do other things with the message, then the fullsed
command you can put in a script is: