Re: [exim] rewrite incorrect date headers from email clients

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Sebastian Nielsen
Dátum:  
Címzett: Evgeniy Berdnikov
CC: exim users
Tárgy: Re: [exim] rewrite incorrect date headers from email clients
1: By simply dropping the date header and inserting a new with the
server time. Problem solved. If the header was correct, it will still
be correct when replaced.
2: Yeah, but many clients handle date: header astonishly bad too. For
example sorting the email by date: header instead of actual received
date, which messes up sorting if the date: header in mail is just a
few hours or Days off. So fixing the date: header is a good thing,
both when sending and receiving emails. Makes every client happy. And
if there is doubt about the email's actual transmit date, its easy to
check in the headers anyways and use the Received: lines to find out
if any delay happened.
3: naah.

So I solved it with a ACL similiar to this:

  accept
    condition = ${if def:h_date:{yes}{no}}
    remove_header = date
    add_header = Date: $tod_full
  accept
    add_header = Date: $tod_full


The first one deletes any old date header and inserts a new date
header with the server time.
The second one just inserts a date header if the original mail misses one.

2018-05-27 0:09 GMT+02:00 Evgeniy Berdnikov via Exim-users
<exim-users@???>:
> On Sat, May 26, 2018 at 09:52:28PM +0200, Sebastian Nielsen via Exim-users wrote:
>> How I do to rewrite the date header from email clients in exim4 config
>> so it are replaced with the server date/time?
>>
>> The problem is that some clients and software are submitting an
>> incorrect date header (like 1 jan 1960) causing the email to be
>> delivered to the bottom of user's clients and sometimes sorted as spam
>> due to the incorrect date.
>>
>> So I would want to replace the incorrect header with an correct one
>> fetched from the server time.
>> How can this be accomplished?
>
> 1. It's not clear how you would decide that date header is incorrect.
> Which creteria would be used for such decision?
>
> 2. Header rewriting means delivery of wrong (false) information to
> recipient, that is a Bad Thing. If you want to deliver a mail with
> "correct date", you have better to make a special mail message
> for user and attach a copy of the original mail to it.
>
> 3. Alternative approach is to reject mails with incorrect date header.
> There is no problem to write ACL which check, for example, presence
> of current year in date header, as "2018" substring. Do not forget
> to reject with some informative message for sender, say, "This message
> was rejected because it has invalid date header "$h_date:"".
> --
> Eugene Berdnikov
>
> --
> ## List details at https://lists.exim.org/mailman/listinfo/exim-users
> ## Exim details at http://www.exim.org/
> ## Please use the Wiki with this list - http://wiki.exim.org/