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

Top Page
Delete this message
Reply to this message
Author: Graeme Fowler
Date:  
To: exim users
Subject: Re: [exim] Message rejected due to long Reference: header
On 16 Apr 2019, at 04:27, Konstantin Boyandin (lists) via Exim-users <exim-users@???> wrote:
> 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?


I feel your pain; I had to migrate 20000 or so student mailboxes from Gmail to Exchange Online (Office 365) a couple of years back and there were thousands of messages with over-long lines (but not headers!) and EOL would not accept them. We used imapsync which allows in-flight modification of the message, so we split at 998 chars and added \r\n as a line break. Anyhow...

I don’t think there is a generic ‘fold over-long header lines’ option, as that interferes with the mantra of not changing the message in flight.

Main config option ‘header_line_maxsize’ is both your friend and enemy here - the default is 0; you clearly have it set to 998.

If you want to fold a header, you’ll need to remove and replace the header:

* Set global option ‘header_line_maxsize' to 0 (or don’t specify it at all)
* Set an ACL variable (in the DATA ACL) to contain the value of the header if it’s longer than 998 chars
* Use sg on that variable to add ‘\r\n ‘ every 990 characters
* Use headers_remove and headers_add on the appropriate transport to replace the over-long line header

HOWEVER: I don’t think this is advisable, as you could break DKIM signing if the over-long header is included in the signature. You may also need to experiment on whether this is best applied using header_thing or rheader_thing - probably the latter.

Graeme