Sieve: adding Date: header when missing
Hello,
there is a way with a sieve rule to add a Date: header when it is missing? Adding one with the time of reception of the message or using the date from the the first Received: header would be good options.
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically.
Thanks. Cheers, Daniele
Am 17.07.2014 16:13, schrieb Daniele Nicolodi:
there is a way with a sieve rule to add a Date: header when it is missing? Adding one with the time of reception of the message or using the date from the the first Received: header would be good options.
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically
in no case that's dovecot related
if at all the MTA has to deal with metadata as it does with missing message-id's - LDA/LMTP should never change anything inside a message and just store "as it is"
BTW: i guess smokeping Fedora has fixed that after a bugreport from me months ago
Hello Harald,
On 17/07/2014 16:30, Reindl Harald wrote:
Am 17.07.2014 16:13, schrieb Daniele Nicolodi:
there is a way with a sieve rule to add a Date: header when it is missing? Adding one with the time of reception of the message or using the date from the the first Received: header would be good options.
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically
in no case that's dovecot related
Indeed. Maybe my question was not clear, what I'm asking is a way to add the header to the specific messages via a sieve rule. I can add headers via sieve but I don't know if there is a way to get the current time or to set an header with information from another.
if at all the MTA has to deal with metadata as it does with missing message-id's - LDA/LMTP should never change anything inside a message and just store "as it is"
The default behavior of the clients I'm using is to use the time at which the message has been retrieved from the IMAP server, which does not really make sense to me.
BTW: i guess smokeping Fedora has fixed that after a bugreport from me months ago
I don't know what smokeping is.
Cheers, Daniele
Am 17.07.2014 16:46, schrieb Daniele Nicolodi:
Hello Harald,
On 17/07/2014 16:30, Reindl Harald wrote:
Am 17.07.2014 16:13, schrieb Daniele Nicolodi:
there is a way with a sieve rule to add a Date: header when it is missing? Adding one with the time of reception of the message or using the date from the the first Received: header would be good options.
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically
in no case that's dovecot related
Indeed. Maybe my question was not clear, what I'm asking is a way to add the header to the specific messages via a sieve rule. I can add headers via sieve but I don't know if there is a way to get the current time or to set an header with information from another.
as said: fix the application or try to solve that at MTA level
if at all the MTA has to deal with metadata as it does with missing message-id's - LDA/LMTP should never change anything inside a message and just store "as it is"
The default behavior of the clients I'm using is to use the time at which the message has been retrieved from the IMAP server, which does not really make sense to me.
because the date header is mandatory undefined behavior
i had running MTA's reject any message missing date or message-id at all
BTW: i guess smokeping Fedora has fixed that after a bugreport from me months ago
I don't know what smokeping is
http://oss.oetiker.ch/smokeping/
well, it was a localized date header, not a missing one buit the result is the same - no date at all displayed by clients https://bugzilla.redhat.com/show_bug.cgi?id=1080949
On 17/07/2014 16:50, Reindl Harald wrote:
as said: fix the application or try to solve that at MTA level
If it were so simple to convince people to fix their applications (I especially hate applications refusing the "+" character in email address local part), the world would definitely be a better place :)
Cheers, Daniele
Am 17.07.2014 18:24, schrieb Daniele Nicolodi:
On 17/07/2014 16:50, Reindl Harald wrote:
as said: fix the application or try to solve that at MTA level
If it were so simple to convince people to fix their applications (I especially hate applications refusing the "+" character in email address local part), the world would definitely be a better place :)
that's why i said "or try to solve that at MTA level" sieve is just the wrong tool for that
On Thu, Jul 17, 2014 at 04:50:20PM +0200, Reindl Harald wrote:
as said: fix the application or try to solve that at MTA level
The correct place would be the MSA.
If all mail genrated by Web appliocations woul pass through a working MSA fixing them up, a lot of problems would go away.
if at all the MTA has to deal with metadata as it does with missing message-id's - LDA/LMTP should never change anything inside a message and just store "as it is"
An intermediate MTA has no business meddling with headers except for trace headers as specified in the standard.
because the date header is mandatory undefined behavior
right
i had running MTA's reject any message missing date or message-id at all
Message-ID is SHOULD.
Only Date and From are required.
And refusing mails without them is a good strategy, if your (recipient) customers don't complain.
Jost
| Helft Spam ausrotten! HTML in Mail ist unhöflich. | | Postmaster, JAPH, manchmal Wahrsager am RZ der RUB | | Bitte immer an Funktionsadressen schreiben: Postmaster@rub.de |
Am 17.07.2014 21:19, schrieb Jost Krieger:
On Thu, Jul 17, 2014 at 04:50:20PM +0200, Reindl Harald wrote:
as said: fix the application or try to solve that at MTA level
The correct place would be the MSA.
pfff MSA / MTA - 999 out of 1000 "MSA" setups are just postfix or exim on localhost and no need for RFC6409 at all
If all mail genrated by Web appliocations woul pass through a working MSA fixing them up, a lot of problems would go away
sane webservers have a MTA only listening on 127.0.0.1 and if it is only to queue them proper and finally relay them to the destination
the first thing sane webservers do is block mail() functions like PHP's one using the sendmail binary and enforce using SMTP
On -10.01.-28163 20:59, Daniele Nicolodi wrote:
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically.
RFC 5322 3.6. (and AFAIK *all* its predecessors) marks the Date: header as mandatory. sendmail used to forcibly add one if missing, I'm not sure about other MTAs (and MSAs). I'ld recommend to try fixing the problem as early and globally as possible, rather than on the last yard into *one specific* mailbox.
Regards, J. Bern
*NEU* - NEC IT-Infrastruktur-Produkte im http://www.linworks-shop.de/: Server--Storage--Virtualisierung--Management SW--Passion for Performance Jochen Bern, Systemingenieur --- LINworks GmbH http://www.LINworks.de/ Postfach 100121, 64201 Darmstadt | Robert-Koch-Str. 9, 64331 Weiterstadt PGP (1024D/4096g) FP = D18B 41B1 16C0 11BA 7F8C DCF7 E1D5 FAF4 444E 1C27 Tel. +49 6151 9067-231, Zentr. -0, Fax -299 - Amtsg. Darmstadt HRB 85202 Unternehmenssitz Weiterstadt, Geschäftsführer Metin Dogan, Oliver Michel
On 17.7.2014 16:40, Jochen Bern wrote:
On -10.01.-28163 20:59, Daniele Nicolodi wrote:
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically.
RFC 5322 3.6. (and AFAIK *all* its predecessors) marks the Date: header as mandatory. sendmail used to forcibly add one if missing, I'm not sure about other MTAs (and MSAs). I'ld recommend to try fixing the problem as early and globally as possible, rather than on the last yard into *one specific* mailbox.
Regards, J. Bern
Postfix is able to add the header, if you configure it do so. According to its documentation "this may break DKIM signatures that cover non-existent headers", so it's off by default.
(More in man 5 postconf - always_add_missing_headers.)
On 17/07/2014 17:34, Jiri Bourek wrote:
On 17.7.2014 16:40, Jochen Bern wrote:
On -10.01.-28163 20:59, Daniele Nicolodi wrote:
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically.
RFC 5322 3.6. (and AFAIK *all* its predecessors) marks the Date: header as mandatory. sendmail used to forcibly add one if missing, I'm not sure about other MTAs (and MSAs). I'ld recommend to try fixing the problem as early and globally as possible, rather than on the last yard into *one specific* mailbox.
Regards, J. Bern
Postfix is able to add the header, if you configure it do so. According to its documentation "this may break DKIM signatures that cover non-existent headers", so it's off by default.
(More in man 5 postconf - always_add_missing_headers.)
Thanks Jiri, this is the best solution.
Cheers, Daniele
Am 17.07.2014 16:13, schrieb Daniele Nicolodi:
Hello,
there is a way with a sieve rule to add a Date: header when it is missing? Adding one with the time of reception of the message or using the date from the the first Received: header would be good options.
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically.
Thanks. Cheers, Daniele
http://tools.ietf.org/html/rfc5260#section-5.1
Finally, currentdate can be used in conjunction with the editheader extension to insert a header-field containing date/time information: require ["variables", "date", "editheader"]; if currentdate :matches "std11" "*" {addheader "Processing-date" "${0}";}
-- Alex JOST
On 17/07/2014 16:51, Alex JOST wrote:
Am 17.07.2014 16:13, schrieb Daniele Nicolodi:
Hello,
there is a way with a sieve rule to add a Date: header when it is missing? Adding one with the time of reception of the message or using the date from the the first Received: header would be good options.
Unfortunately I'm receiving some useful automated messages that lack a Date header and this screws up the sorting in my imap clients. I have a script to fix those acting on the Maildir storage, but I would prefer to have the thing solved more radically.
Thanks. Cheers, Daniele
http://tools.ietf.org/html/rfc5260#section-5.1
Finally, currentdate can be used in conjunction with the editheader extension to insert a header-field containing date/time information: require ["variables", "date", "editheader"]; if currentdate :matches "std11" "*" {addheader "Processing-date" "${0}";}
Thanks Alex,
I expanded this a bit to use the date from the Received header:
if not exists "Date" { if date :matches "received" "std11" "*" { addheader "Date" "${0}"; } }
However I believe the issue is better fixed in the MTA and I instructed my Postfix to do it.
Cheers, Daniele
participants (6)
-
Alex JOST
-
Daniele Nicolodi
-
Jiri Bourek
-
Jochen Bern
-
Jost Krieger
-
Reindl Harald