[prev in list] [next in list] [prev in thread] [next in thread]
List: procmail
Subject: Re: mail from the future
From: Michelle Konzack <linux4michelle () freenet ! de>
Date: 2007-02-13 18:35:37
Message-ID: 20070213183537.GF2727 () freenet ! de
[Download RAW message or body]
Am 2007-02-07 00:15:25, schrieb ignotus@freemail.hu:
> Hello, rarely I get mail "from the future" (the Date header carries a
> date that is in the future). In this case, I would like to replace the
> Date header with the current date from procmail, how can I do that? I
> am sure lot of people would like to have a solution for this.
You can do something like:
----8<------------------------------------------------------------------
:0
{
# Maximum allowed DIFF in seconds
SECS=86400
# Get the Date/time from the Message
MAILDATE=`formail -czX Date:`
# Convert the Date/Time to a Serialdate
M_DATE=`date --date="${MAILDATE}" +%s`
# Get the current RFC-Date
RFC_DATE=`date --rfc-822`
# Convert thew current RFC-Date to Serialdate
C_DATE=`date --date="${RFC_DATE}" +%s`
# Calculate the difference in Seconds
DIFF=`echo "${C_DATE}-${M_DATE}" |bc`
# Filter the E-Mail IF the DIFF-Seconds are bigger then X
# How to check a VAR, whether the Value is greater then X?
:0 fw
* -${SECS}^0
* ${DIFF}^1
|formail -fI "Date: ${RFC_DATE}"
}
----8<------------------------------------------------------------------
Greetings
Michelle Konzack
Systemadministrator
Tamay Dogan Network
Debian GNU/Linux Consultant
--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack Apt. 917 ICQ #328449886
50, rue de Soultz MSM LinuxMichi
0033/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
____________________________________________________________
procmail mailing list Procmail homepage: http://www.procmail.org/
procmail@lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic