How To Add Text Footer Using MimeKit

518 views Asked by At

I have attempted to add a footer to an email message using MimeKit, but the added footer appears as an attachment on the email, rather than just text appended to the message.

multipart.Add(new TextPart("text") { Text = "Hello World" });

What is the correct way to add a footer using MimeKit?

1

There are 1 answers

0
jstedfast On BEST ANSWER

What you are doing in your sample code is adding a new MIME part, but what you probably want to do is append some text to an existing text/plain part, right?

If my understanding is correct, then what you first want to do is to find the particular TextPart in the message that you want to add the footer to. For example:

var part = message.BodyParts.OfType<TextPart> ().FirstOrDefault ();
part.Text += Environment.NewLine + footer;