Fix oversize References header lines that cause error 554
Posted by Matthew   on 04 April 2016 05:39 PM

Symptom:  Messages are stuck in the server's outgoing queue. SMTP log shows there is a permanent error 554 when IceWarp tries to send the message to the recipient's server.

Cause: The receiving server may reject the message if it does not comply with RFC822 / RFC2822 formatting requirements. The maximum length of a line, including the terminating CRLF, is 1000 characters. Mail clients should wraps lines as necessary to ensure the message is correctly formatted before submitting it to the server. Buggy clients may submit messages that have overly wrong lines. For example, it has been observed that messages sent from Outlook may have a References: line in the header which has 1000 characters following "References: " for a total line length of 1014 characters. Clients regularly append to this line and should wrap it as necessary to not exceed the maximum line length. In this example, the mail client (Outlook) is obviously neglecting to include the header label and terminating characters in the length calculation.

Solution: Trim the References: line to fit. The SMTP RFC says the server may trim references and must do so if the line would be too long. Any but the first and last two references may be removed. A content filter such as the following may be used to remove the middle references.

Filter on: Where header contains: References:+(.{984,})

Edit header: References:

RegEx: (.{1,100})>\s?<.*>\s?<(.{200,})$

Value: $1> <$2


(1 vote(s))
Not helpful

Comments (0)