Idea ID: 2870924

Accept emails with a line length greater than 1000 characters

Status : New Idea

We've recently moved to SMG and are finding emails from some suppliers and customers are being rejected by SMG, due to an excessive line length.  The error in the SMTP log is:

500 SMTP connection violates RFC5322 2.1.1 rule of 1000 characters per line.  Fix your mailer.

RFC5322 2.1.1 says that emails must have less than 1000 characters per line.  However, it also says:

Receiving implementations would do well to handle an arbitrarily large number of characters in a line for robustness sake.

Can SMG be fixed to follow the recommendation from the RFC?  This is sadly critical for us, as without this, we're going to have to go back to our old anti-spam system.  We can't afford to not receive emails from some suppliers and customers.



  • Sorry, I read your snippet as being taken from the 3rd paragraph which has very similar wording.  I see where your quote came from now.  Regardless, that information relates to robustness of the MTA, in that it shouldn't fail as a result of a sender issuing more than the prescribed limit, it's not about accepting the data.  The declaration is very clear at the start of the section, which quite specifically uses the word MUST to enforce that this is a hard rule.  Interestingly, from what I've seen, there seems to have been a misinterpretation of section of RFC5321 that might have been where a lot of this non-conformance began.

    The setting for line lengths are both used depending on what recipients are given to SMG.  If you only have incoming mail, then the domains will be the only setting you need to touch.  Any messages that are to an unlisted domain are considered outbound from the perspective of SMG, which is where the external delivery setting will become the value used.

    The purpose of those settings is to align SMG with the enforcement rules of the next server.  There's no point in SMG accepting non-conformant MIME, only to have it rejected by the next hop gateway.  The default value for that line length must necessarily be the length given in the specification.  Whatever server you have behind SMG will either follow the rules, or have some arbitrary number as its setting, which would be worth checking.  I know that Exchange has had slow creep in their default setting as people have created bigger and bigger one-line HTML message templates over time.  Last time I looked I think they'd got to 128k.

  • The option in the interface settings that you are referring to is under 'External Delivery'.  This seems to imply that it's for outgoing messages only, so the documentation is unclear.  It seems to be that setting this to over 1000 characters would make SMG send emails out with potentially line lengths over 1000 characters.

    The setting under Organization / Policy Management -> Domain Management -> Your Domain -> SMTP Hosts seems much more relevant to the problem we had, as that is for incoming emails.

    Just to correct you, the RFC comment wasn't manipulated or taken out of context in any way at all.  It was a direct cut and paste from the RFC (2nd paragraph of section 2.1.1), which doesn't have anything to do with message viewers or presenting a messages to a user.

  • I see you have already discovered the answer, and for others that might look at this, the option is in the interface settings, and also per-domain target.

    I must respond to the comment with respect to the RFC, as that is both taken out of context and manipulated from its original text.  That statement is with regards to message viewers handling arbitrarily long line lengths when presenting messages to a user, not the SMTP protocol.  It also clarifies that the arbitrary length handled by a viewer should at least be up to the hard limit of 998 characters.

    There is good reason for a line length limit in the SMTP protocol.  If it was not there, then we'd have runaway problems of hackers running DoS attacks on systems with ease.  Servers that accept line lengths longer than the well defined limit are the bane of the email world.  Unfortunately it's due to what I consider an oversight in the original SMTP RFC that could reasonably easily be rectified, but as it is, the standard has never changed, and it's up to mail senders to conform to the rules laid out in black and white.

  • I've found out that SMG already does this, so please reject this.  It's not in the documentation though....