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

How to get PlainText or Html Text ? #82

Open
LeMoussel opened this issue Jun 4, 2012 · 2 comments
Open

How to get PlainText or Html Text ? #82

LeMoussel opened this issue Jun 4, 2012 · 2 comments

Comments

@LeMoussel
Copy link

I'm trying to get Plain Text or HTML Text of email but I cannot find any documentation and I did not find features such as EmailMessage.BodyText.Text / EmailMessage.BodyHtml.Text or EmailMessage.GetBodyPlainText() / EmailMessage.GetBodyHTMLText()

I developed this C# code to do. What do you think?

   IList<Attachment> iList;
   string HtmlText = "", PlainText = "";

   for (var i = pop3.GetMessageCount() - 1; i >= 0; i--)
   {
      MailMessage msg = pop3.GetMessage(i);
      TextBody = msg.Body;
      iList = msg.AlternateViews as IList<Attachment>;
      if (iList.Count == 0) iList = msg.Attachments as IList<Attachment>;
      if (iList.Count > 0)
      {
           TextBody = iList[0].Body;
           HtmlBody = iList[1].Body;
      }
   }
@MichalPaszkiewicz
Copy link

Thank you SO MUCH. You are awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@LeMoussel @MichalPaszkiewicz and others