Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quoted-printable encoder generates lines longer than 76 characters #781

Closed
georg87 opened this issue Mar 18, 2022 · 0 comments
Closed

quoted-printable encoder generates lines longer than 76 characters #781

georg87 opened this issue Mar 18, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@georg87
Copy link

georg87 commented Mar 18, 2022

Describe the bug
The quoted-printable encoder generates lines longer than the allowed 76 characters in case '=' is the 76th sign of a line. The '=' sign is encoded with '=3D' and the line becomes 78 characters long.

Platform (please complete the following information):

  • OS: Windows, Linux (Docker)
  • .NET Runtime: CoreCLR
  • .NET Framework: .NET 6.0
  • MimeKit Version: 3.1.1 (MimeKitLite)

Expected behavior
The quoted-printable encoder generates lines which are no longer than 76 characters.

Code Snippets

MimeKit.MimeMessage msg = new MimeKit.MimeMessage();
MimeKit.BodyBuilder builder = new MimeKit.BodyBuilder();
builder.HtmlBody = "<table style=\"width:100%;\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td style=\"width:100%;text-align:center;background-color:;\" bgcolor=\"\">Test</td></tr><table>";
msg.Body = builder.ToMessageBody();
// force quoted-printable encoding for this example
(msg.BodyParts.First() as MimeKit.MimePart).ContentTransferEncoding = MimeKit.ContentEncoding.QuotedPrintable;

Console.WriteLine(msg.Body.ToString());

/*

Output (second line is too long):

Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

<table style=3D"width:100%;" cellpadding=3D"0" cellspacing=3D"0" border=3D"0=
"><tr><td style=3D"width:100%;text-align:center;background-color:;" bgcolor=3D=
"">Test</td></tr><table>

*/
@jstedfast jstedfast added the bug Something isn't working label Mar 18, 2022
jstedfast added a commit that referenced this issue Mar 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants