On Sun, May 16, 2021 at 10:32:33AM +1000, raf wrote: > > When my workplace switched to office365 (all but me anyway), > their emails started arriving with UTC date headers. So I > wrote a procmail recipe to filter incoming emails through > a little perl script to convert the date header to my timezone. > it's attached. the local timezone is hardcoded (sorry) but > can be changed as needed.
Something similiar, just with procmail/formail:
You need Gnu date for this, sorry non-Posix features used.
{
#time in seconds since the epoch (to be rethought before Jan 19 2038 03:14:08)
:0 hi
* ^Date:[ ]*(...?, )?\/[^,]*$
# ^^^^^^^^ this blank contains a space and a tab, and yes, there are
strange date: header out there
DATE=| date -d "$MATCH" +%s
# catch unparsable/missing dates
:0 hi
* DATE ?? ^$
DATE=| echo "0"
:0 fwhi
| formail -i "Date: `TZ=America/Los_Angeles date -d @$DATE -R`"
}
Just leave out TZ= to get your default timezone
HTH,
Joerg
signature.asc
Description: PGP signature
