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

BodyBuilder renders incorrectly if the htmlBody is set to Empty instead of null #506

Closed
LeeBear35 opened this issue Sep 12, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@LeeBear35
Copy link

Describe the bug
In converting an email that has plain text, but empty html text, the BodyBuilder.ToMessageBody() will return an empty body flagged as IsHTML, instead of the Plain Text and Flagged as IsPlain

Platform (please complete the following information):

  • OS: Windows 10
  • .NET Runtime: 4.6.2
  • .NET Framework: .Net 4.6
  • MimeKit Version: 2.1.2

To Reproduce
Steps to reproduce the behavior:

BodyBuilder bodyBuilder = new MimeKit.BodyBuilder();
bodyBuilder.TextBody = "hello world";
bodyBuilder.HtmlBody = "";
Console.Out.WriteLine(BodyBuild.ToMessageBody());

Expected behavior
{Content-Type: text/plain; charset=utf-8

hello world}
Content: {MimeKit.MimeContent}
ContentBase: null
ContentDisposition: null
ContentDuration: null
ContentId: null
ContentLocation: null
ContentMd5: null
ContentObject: {MimeKit.MimeContent}
ContentTransferEncoding: Default
ContentType: {Content-Type: text/plain; charset="utf-8"}
FileName: null
Headers: {MimeKit.HeaderList}
IsAttachment: false
IsEnriched: false
IsFlowed: false
IsHtml: false
IsPlain: true
IsRichText: false
Text: "hello world"

OR
{Content-Type: multipart/alternative; boundary="=-IBNbMcf6MOJgOQ7NgeFvKg=="

--=-IBNbMcf6MOJgOQ7NgeFvKg==
Content-Type: text/plain; charset=utf-8

hello world
--=-IBNbMcf6MOJgOQ7NgeFvKg==
Content-Type: text/html; charset=utf-8
Content-Id: NR2XI6PGJ8U4.2QQ28EBFN34A1@ATL01L24788

--=-IBNbMcf6MOJgOQ7NgeFvKg==--
}
Boundary: "=-IBNbMcf6MOJgOQ7NgeFvKg=="
ContentBase: null
ContentDisposition: null
ContentId: null
ContentLocation: null
ContentType: {Content-Type: multipart/alternative; boundary="=-IBNbMcf6MOJgOQ7NgeFvKg=="}
Count: 0x00000002
Epilogue: null
Headers: {MimeKit.HeaderList}
HtmlBody: "xxx"
IsAttachment: false
IsReadOnly: false
Preamble: null
TextBody: "hello world"
Results View: Expanding the Results View will enumerate the IEnumerable

Actual
{Content-Type: text/html; charset=utf-8
Content-Id: F0TUDLOGJ8U4.Z29WI0NZAH401@ATL01L24788

}
Content: {MimeKit.MimeContent}
ContentBase: null
ContentDisposition: null
ContentDuration: null
ContentId: "F0TUDLOGJ8U4.Z29WI0NZAH401@ATL01L24788"
ContentLocation: null
ContentMd5: null
ContentObject: {MimeKit.MimeContent}
ContentTransferEncoding: Default
ContentType: {Content-Type: text/html; charset="utf-8"}
FileName: null
Headers: {MimeKit.HeaderList}
IsAttachment: false
IsEnriched: false
IsFlowed: false
IsHtml: true
IsPlain: false
IsRichText: false
Text: ""

jstedfast added a commit that referenced this issue Sep 13, 2019
@jstedfast
Copy link
Owner

Thanks!

@jstedfast jstedfast added the bug Something isn't working label Sep 13, 2019
@jstedfast
Copy link
Owner

For anyone experiencing this bug, use the MimeKit nuget package from https://www.myget.org/feed/mimekit/package/nuget/MimeKit until a 2.3.2 version is released to nuget.org

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