–2 votes

Mail component does not decodify headers with "Soft line breaks" properly, for more information:

http://stackoverflow.com/questions/17093964/mime-encoded-headers-with-extra-utf-8bbase64string

by

1 Answer

0 votes

You are incorrect.

You are confusing 'Quoted Printable' Content-Transfer-Encoding with 'Q-encoded' encoded words.

Soft line breaks apply to 'Quoted Printable' Content-Transfer-Encoding only. 'Quoted Printable' encoding can be used in MIME entity's body (RFC 2045 Section 6.7.) only.

In MIME headers encoded words are used (RFC 2047 Section 2.).

Having this MIME header:

Subject: =?UTF-8?B?dGVzdA==?===?UTF-8?B?dGVzdA====?=

Subject should be decoded as:

test=test

Here's the unit test:

string eml = @"Subject: =?UTF-8?B?dGVzdA==?===?UTF-8?B?dGVzdA====?=
Content-Transfer-Encoding: Quoted-Printable

same line=
same line";

IMail mail = new MailBuilder().CreateFromEml(Encoding.ASCII.GetBytes(eml));

Assert.AreEqual("test=test", mail.Subject);
Assert.AreEqual("same linesame line", mail.Text);  // no new line
by (297k points)
...