File tree Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Expand file tree Collapse file tree 1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -875,11 +875,28 @@ impl MimeFactory {
875
875
}
876
876
} else if is_encrypted && header_name == "date" {
877
877
protected_headers. push ( header. clone ( ) ) ;
878
+
879
+ // Coarse-grained date goes to unprotected header.
880
+ //
881
+ // We cannot just send "Thu, 01 Jan 1970 00:00:00 +0000"
882
+ // or omit the header because GMX then fails with
883
+ //
884
+ // host mx00.emig.gmx.net[212.227.15.9] said:
885
+ // 554-Transaction failed
886
+ // 554-Reject due to policy restrictions.
887
+ // 554 For explanation visit https://postmaster.gmx.net/en/case?...
888
+ // (in reply to end of DATA command)
889
+ //
890
+ // and the explanation page says
891
+ // "The time information deviates too much from the actual time".
892
+ let coarse_grained_timestamp = self . timestamp - ( self . timestamp % 1000000 ) ;
893
+ let unprotected_date =
894
+ chrono:: DateTime :: < chrono:: Utc > :: from_timestamp ( coarse_grained_timestamp, 0 )
895
+ . unwrap ( )
896
+ . to_rfc2822 ( ) ;
878
897
unprotected_headers. push ( (
879
898
"Date" ,
880
- mail_builder:: headers:: HeaderType :: Raw (
881
- "Thu, 01 Jan 1970 00:00:00 +0000" . into ( ) ,
882
- ) ,
899
+ mail_builder:: headers:: raw:: Raw :: new ( unprotected_date) . into ( ) ,
883
900
) ) ;
884
901
} else if is_encrypted {
885
902
protected_headers. push ( header. clone ( ) ) ;
You can’t perform that action at this time.
0 commit comments