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

Text/Plain Attachment content show up in body as well as in attachment. #391

Closed
irikeish opened this issue Apr 12, 2018 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@irikeish
Copy link

I am trying to create mail,using MimeKit.BodyBuilder class like this:

var mail = new MailMessage();
mail.To.Add(new MailboxAddress("name1","name1@def.com");
mail.From.Add(new MailboxAddress("name2","name2@def.com");
var builder = new BodyBuilder();
builder.textBody = "";
buider.Attachments.Add(file);
mail.body = builder.ToMessageBody(); 

when I send this mail, iff attached file is of Text/Plain, then it's content is showing up in the body also. Note this problem doesn't occur when the attachment is xml,json,etc.

Please, point out the problem.

jstedfast added a commit that referenced this issue Apr 12, 2018
Previously, setting these properties to string.Empty was
treated the same as setting them to null.

Fixes issue #391
@jstedfast
Copy link
Owner

The problem is that you aren't setting a text or html body, so the receiving client shows the text attachment because it has nothing else to show.

I've changed the code so that if you set the TextBody to string.Empty, it just adds an empty inline text part.

@jstedfast jstedfast added the bug Something isn't working label Apr 12, 2018
@jstedfast
Copy link
Owner

Fixed published to nuget.org as v2.0.3

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