Am 2007-02-07 00:15:25, schrieb ignotus(_at_)freemail(_dot_)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(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail