snoyberg / mime-mail

Compose MIME email messages.
41 stars 43 forks source link

Length of `encoded-words` #57

Open toonn opened 5 years ago

toonn commented 5 years ago

It seems like the implementation doesn't respect the character limit on encoded-words specified in RFC-2047. The following example string is 139 characters:

"This \"encoded-word\" is longer than 75 characters which is not allowed according to RFC-2047 (https://tools.ietf.org/html/rfc2047#section-2)"

It results in the following encoded-word representation:

=?utf-8?Q?This_=22encoded-word=22_is_longer_than_75_characters_which_is_not_allowed_according_to_RFC-2047_=28https=3A//tools=2Eietf=2Eorg/html/rfc2047#section-2=29?=

As I read it the RFC requires the following (I included a field identifier because I believe it's included in the count):

To: =?utf-8?Q?This_=22encoded-word=22_is_longer_than_75_characters_which_?=
 =?utf-8?Q?is_not_allowed_according_to_RFC-2047_=28https=3A//tools=2Eietf?=
 =?utf-8?Q?=2Eorg/html/rfc2047#section-2=29?=
kindaro commented 4 years ago

@toonn  So, according to the standard, the encoded header should be split into multiple lines each up to 75 bytes, and mime-mail does not do that. Do I understand you right?

If this causes problems for you and you are willing to put in the work, I shall merge a patch that exposes (say, via a quick check property) and fixes this issue, for a total of 2 commits. Unfortunately it is unlikely that I shall be able to find time to do it myself, and probably the same can be said about other maintainers.