File tree Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Expand file tree Collapse file tree 1 file changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -875,12 +875,27 @@ impl MimeFactory {
875875 }
876876 } else if is_encrypted && header_name == "date" {
877877 protected_headers. push ( header. clone ( ) ) ;
878- unprotected_headers. push ( (
879- "Date" ,
880- mail_builder:: headers:: HeaderType :: Raw (
881- "Thu, 01 Jan 1970 00:00:00 +0000" . into ( ) ,
882- ) ,
883- ) ) ;
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 = chrono:: DateTime :: < chrono:: Utc > :: from_timestamp ( coarse_grained_timestamp, 0 )
894+ . unwrap ( )
895+ . to_rfc2822 ( ) ;
896+ unprotected_headers. push ( ( "Date" ,
897+ mail_builder:: headers:: raw:: Raw :: new ( unprotected_date) . into ( ) )
898+ ) ;
884899 } else if is_encrypted {
885900 protected_headers. push ( header. clone ( ) ) ;
886901
You can’t perform that action at this time.
0 commit comments