Skip to content

Instantly share code, notes, and snippets.

View phoehnel's full-sized avatar

Pascal Höhnel phoehnel

View GitHub Profile
@pimpreneil
pimpreneil / fix-email-maildir-timestamps.sh
Last active September 5, 2020 18:44
Fix email maildir timestamps
#!/bin/bash
# Fix emails with bad timestamps in a maildir
# This script reads the date from the email header and set its UNIX timestamp and renames it with the proper date
# e.g. this:
# dec. 05 2017 1512499812.M908995P21566.ip-111-11-11-11,S=16331,W=16746:2,S
# becomes that (the email Date header is "Date: Tue, 22 Oct 2013 10:07:21 +0100"):
# oct. 22 2013 1382432841.M908995P21566.ip-111-11-11-11,S=16331,W=16746:2,S
cd "/var/mail/my@account.org/MyMailDir/cur";