![get body of email with eagetmail get body of email with eagetmail](https://www.emailarchitect.net/img/eagetmail/csharp_eagetmail.png)
The reason for sending the message text in both formats is that not all mail clients are capable of displaying HTML. The text/html version is typically formatted much closer to what the sender saw in his or her WYSIWYG editor than the text/plain version. Modern MIME messages will often contain a multipart/alternative MIME container which will generally contain a text/plain and text/html version of the text that the sender wrote. There's a bit more to it than that, though. Technically, every part that lacks a Content-Disposition header or that is marked as inline, then, is part of the core message body. If the Content-Disposition header does not exist, then it should be treated as if the value were inline. However, if the value is inline, then the content of that MIME part is meant to be displayed inline within the mail client's rendering of the core message body. If the value is attachment, then the content of said MIME part is meant to be presented as a file attachment separate from the core message.
![get body of email with eagetmail get body of email with eagetmail](https://www.emailarchitect.net/img/eagetmail/vb_eagetmail.jpg)
The meaning of these values should be fairly obvious. The Content-Disposition header will generally have one of two values: inline or attachment. The Content-Disposition header is meant to provide hints to the receiving client as to which parts are meant to be displayed as part of the message body and which are meant to be interpreted as attachments. Luckily, MIME does define a set of general rules for how mail clients should interpret this tree structure of MIME parts. The reality is that MIME is a tree structure of content, much like a file system. body property using Mailkit (to return only the body contents in plain text, as the user sees)?Ī common misunderstanding about email is that there is a well-defined message body and then a list of attachments. My question is how do I replicate the effect of EAgetmail's. I also tried () and searching through the message parts for plain text, but neither worked. Query = SearchQuery.SubjectContains("Subject to find") SearchQuery.SubjectContains("Subject to find")) SearchQuery.DeliveredAfter((DateTime)dateStart)).And( Query = SearchQuery.DeliveredBefore((DateTime)dateEnd).And( This is the relevant code: using (var client = new ImapClient())Ĭ("XOAUTH2") The problem is with EAgetmail the equivalent of message.body returns the body as the user sees it in email clients, but in mailkit it returns a lot of different data. I was using a library called EAgetmail to retrieve the body of a specified email and it was working well, however I am now using Mailkit.