procmail
[Top] [All Lists]

Re: Forcing valid date format in headers?

2001-04-08 15:18:59
Hi,

Please note, i did not follow the entire thread, so if i miss the point
here, please ignore...

++ 06/04/01 19:16 -0400 - Rik Kabel:
[Quote from RFC-822, timezones]
which is unambiguous and arguably fair to all. Perhaps an automated
response to correspondents whose mailers still generate non-compliant
headers should also be considered.

I don't think you want that. I run a test on nearly all incoming mail
which tests for non-RFC-compliant Date fields. You don't want to know
the number of clients that insert Date fields that are formatted
incorrectly (supposing my regexp is correct):

  $ pwd
  /home/rejo/mail
  $ grep -hs "X-Note: .*compliant Date field." * |wc -l
      846
  $ grep -hs "^From " * |wc -l
    11623

This is mail from this year only. So, *if* these numbers are correct and
you'd want to send a automate response back to the senders, you'll most
likely send a lot of email.

Hope this helps.

        -R.


PS. These numbers are correct, supposing this recipe is correct:

  # The definition of $date is not completly correct. the 19 part should be
  # $digit$digit in order to have a regexp that is RFC1123 (which updated RFC822
  # on the syntax of the date) compliant. I have changed it here as anytihing 
but
  # 20 as century would't make sense anyway. Also, keep in mind the test could
  # fail if comments are used within the field. See the note at Message-Id 
recipe
  # below.
  [...]
  ws           = "[       ]*(\([^()]*\)[  ]*)?"
  day          = "(Mon|Tue|Wed|Thu|Fri|Sat|Sun)"
  digit        = "[0-9]"
  month        = "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"
  date         = "$digit?$digit$ws$month$ws(20)?$digit$digit"
  hour         = "$digit$digit:$digit$digit(:$digit$digit)?"
  zone         = 
"((UT|GMT|EST|EDT|CST|CDT|MST|MDT|PST|PDT|([A-I]|[K-Z]))|(+|-)$digit$digit$digit$digit)"
  time         = "$hour$ws$zone"
  [...]
  # Check for messages with an invalid Date field. Comments to check for valid
  # Message-Id fields apply here as well - in other words, they will not be 
  # matched. However, quie frequently a mailer adds the zone both numeric as 
  # well as alphanumeric. Therefor " \([a-z][a-z]?[a-z]?[a-z]?\))?" is added to 
  # match that comment.
  :0
  *$ ! ^Date:$ws($day$ws,$ws)?$date$ws$time($ws\([a-z][a-z]?[a-z]?[a-z]?\))?
  [action]

The comments to which are refered:

  # Check for messages with an invalid Message-Id field. This check is not
  # completely correct as it will not match a Message-Id field like
  #    
  #        Message-Id: (ksdjfhs(kdsfhsdk))<(skjdfh)"\(foo"().
  #                (dfjksdhf)(dkjf(djfh))bar(dkjhfsdkjfkj)@(kjfhsdkjf)host
  #                (sdkjfhsdkjf)>(ksjdfhskjfhksdjfhskdjhf)
  #
  # This Message-Id /is/ RFC822 complaint and is equal to:
  #
  #        Message-Id: <"\(foo"(_dot_)bar(_at_)host>
  #
  # As it is to difficult to catch those comments the check it simplified
  # and will give false positives once in a while. Thanks to Philip.

My entire .procmailrc is online on the URL below.

-- 
# rejo(_at_)sisterray(_dot_)xs4all(_dot_)nl (pgp: see headers) - 
http://www.sisterray.nl
_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>