X-Git-Url: https://git.madduck.net/etc/mailfilter.git/blobdiff_plain/43637a4b0d4bd08e3a36155a84b7e3e05c6bd67f..9afcad17ab7735c44d98866cf1ba530a28ba66bc:/bin/resubmit diff --git a/bin/resubmit b/bin/resubmit index 6227584..52967a5 100755 --- a/bin/resubmit +++ b/bin/resubmit @@ -54,8 +54,9 @@ if [ "$mark_read" -eq 1 ]; then PROCMAIL="$PROCMAIL DELIVER_READ=1" fi -# execute the date -R only during the eval, not immediately -FILTER='/usr/bin/formail -I"X-Resubmitted: $(date -R)"' +DATE_R="$(date -R)" +FILTER="sed -rne ':b;s/^(Received|Date):/&/;tf;p;n;bb' -e ':f;iReceived: by resubmission script; $DATE_R' -e ':e;p;n;be'" +FILTER="$FILTER | /usr/bin/formail -I'X-Resubmitted: $DATE_R'" if [ -z "${files:-}" ] && [ $list -eq 0 ]; then eval $FILTER | exec $PROCMAIL