Using UTC time in Date header
Joerg Dorchain
joerg at dorchain.net
Sun May 16 06:02:01 UTC 2021
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 898 bytes
Desc: not available
URL: <http://lists.mutt.org/pipermail/mutt-users/attachments/20210516/fe3456a5/attachment.asc>
More information about the Mutt-users
mailing list