emailsmtprfc5322

rfc5322: how to fold values without spaces?


I've already seen answer on similar topic, but rfc5322 says:

Unfolding is accomplished by simply removing any CRLF that is immediately followed by WSP.

this can break source spaceless text by adding into it spaces.

so how to fold values without spaces?


Solution

  • The modern solution is to use RFC2047 encoding which allows completely arbitrary folding:

    =?us-ascii?B?A?=
     =?us-ascii?B?B?=
    

    encodes the single string AB, preserving the lack of spaces.