From fb14acb0fb673fe34691f3001d38c2b9afe32f23 Mon Sep 17 00:00:00 2001 From: link2xt Date: Mon, 17 Nov 2025 21:56:21 +0000 Subject: [PATCH] fix: limit the range of Date to up to 6 days in the past Previous value (1000000 seconds) was slightly more than 11.5 days. --- src/mimefactory.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mimefactory.rs b/src/mimefactory.rs index b995c350a..16a2672df 100644 --- a/src/mimefactory.rs +++ b/src/mimefactory.rs @@ -1036,7 +1036,15 @@ impl MimeFactory { // // and the explanation page says // "The time information deviates too much from the actual time". - let timestamp_offset = rand::random_range(0..1000000); + // + // We also limit the range to 6 days (518400 seconds) + // because with a larger range we got + // error "500 Date header far in the past/future" + // which apparently originates from Symantec Messaging Gateway + // and means the message has a Date that is more + // than 7 days in the past: + // + let timestamp_offset = rand::random_range(0..518400); let protected_timestamp = self.timestamp.saturating_sub(timestamp_offset); let unprotected_date = chrono::DateTime::::from_timestamp(protected_timestamp, 0)