login about faq

Hi everybody, By Chillkat IMAP I have to read the email body and store it in a variable. How can I do ? Kind Regards

asked Jul 31 '15 at 05:42

Bicio's gravatar image

Bicio
11


That's quite simple:

        Imap imap = new Imap();

        var success = imap.UnlockComponent(myChilkatImapCode);
        if (success != true)
        {
            Console.WriteLine("Component unlock failed.");
            return;
        }

        imap.Ssl = myImapServerSslEnabled;
        imap.Port = myImapServerPort;

        //  Connect to an IMAP server.
        success = imap.Connect(myImapServerHost);
        if (success != true)
        {
            Console.WriteLine("Chilkat component connect failed: " + imap.LastErrorText);
            return;
        }

        //  Login
        success = imap.Login(myImapServerUser, myImapServerPassword);
        if (success != true)
        {
            Console.WriteLine("Chilkat component login failed: " + imap.LastErrorText);
            return;
        }

        //  Select an IMAP mailbox
        success = imap.SelectMailbox("Inbox"); // You can, of course specify a different IMAP folder here.
        if (success != true)
        {
            Console.WriteLine("Chilkat component select inbox failed: " + imap.LastErrorText);
            return;
        }

        var email = imap.FetchSingle(myImapMailUid, true); // Alternatively use imap.FetchBundle() or imap.FetchSequence(), whichever suits your needs best.
        if (email == null)
        {
            Console.WriteLine("Chilkat component FetchSingle failed: " + imap.LastErrorText);
            return;
        }

        string body;
        if (email.HasHtmlBody())
        {
            body = email.GetHtmlBody();
        }
        else
        {
            body = email.Body;
        }

        // Use body for whatever you want to do.
link

answered Aug 01 '15 at 01:39

coeamyd's gravatar image

coeamyd
261

Thank you very much

link

answered Aug 07 '15 at 04:10

Bicio's gravatar image

Bicio
11

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×174

Asked: Jul 31 '15 at 05:42

Seen: 1,283 times

Last updated: Aug 07 '15 at 07:17

powered by OSQA