Re: [exim] Message rejected due to long Reference: header

Top Page
Delete this message
Reply to this message
Author: Konstantin Boyandin (lists)
Date:  
To: exim-users
Subject: Re: [exim] Message rejected due to long Reference: header
Hi Evgeniy,

On 2019-04-16 09:20, Evgeniy Berdnikov via Exim-users wrote:
> Hi, Konstantin.
>
> On Tue, Apr 16, 2019 at 03:27:57AM +0000, Konstantin Boyandin (lists)
> via Exim-users wrote:
>> One of users complained at having their message rejected by our mail
>> server (Exim 4.91), providing the below server response:
>>
>> "Mail delivery error. This email issue occurs because your email
>> header
>> was rejected by recipient server.
>> The cause of rejection is because email reference header is more than
>> 998 character. The 998 character limit is due to limitations in many
>> implementations that send, receive, or store IMF messages which simply
>> cannot handle more than 998 characters on a line. Receiving
>> implementations would do well to handle an arbitrarily large number of
>> characters in a line for robustness sake."
>
> Probably config of your Exim contains in acl_check_data something
> like:
>
>  deny
>    condition = ${if > {$max_received_linelength}{998}}
>    message = Mail delivery error. This email issue occurs because...
>    ...

>
> If you turn it off, your Exim could receive improperly formatted mail.


Indeed ti is. However, I think it's a bad idea to accept incorrectly
formatted mail, there will be cascade of further problems

>> The user's emails contain:
>>
>> X-Mailer: Microsoft Outlook 15.0
>>
>> Is there any Exim setting capable of re-formatting long headers
>> (i.e., split them into several lines, each below 998 character
>> limit) etc such headers, but allowing the incoming mail nonetheless?
>
> Exim has no such built-in capability (AFAIK).
>
> As for MS Outlook, it has bugs with mail formatting from version 10.
> At most cases the "References:" header is broken and contain garbage.
> There is no sense to reformat it, because this garbage reflects only
> memory corruption and has no valid message-ids. You have better to
> remove
> References: header completely. Put in your config something like this:
>
>  acl_check_data:
>  ...
>  warn
>     set acl_m_ref_len = ${strlen:$h_references:}
>     condition = ${if > {$acl_m_ref_len}{998}}
>     logwrite = References header has length=$acl_m_ref_len, removed
>     remove_header = references


Yes, I applied the above check/removal of extremely long References:,
that's definitely is the lesser evil.

>> We have quite long "threads" in local mail archives, with really
>> many References: entries, but still not exceeding 998 characters per
>> line.
>
> Mail client is responsible for keeping References: withing reasonable
> number of entries and below line length limit.


During many a years (12+) that was the case. We have just recently
stumbled upon a recipient whose mail system doesn't behave well.

Thanks to everyone having responded, for ideas and explanations.

Sincerely,
Konstantin