+1 vote

Dear Sir ,

How Can Date and Subject Wise attachment Download in Imap Dll..Please give me example....

by

1 Answer

0 votes

Hi,

You can find many samples online here:
https://www.limilabs.com/mail/samples

Here's the sample that displays Subject, Date, Text, Html and saves all attachments to disk:

using System;
using System.Collections.Generic;
using Limilabs.Client.IMAP;
using Limilabs.Mail;
using Limilabs.Mail.MIME;
using Limilabs.Mail.Headers;

class Program
{
    static void Main(string[] args)
    {
        using(Imap imap = new Imap())
        {
            imap.Connect("imap.example.com");    // use ConnectSSL for SSL
            imap.UseBestLogin("user", "password");

            imap.SelectInbox();
            List<long> uids = imap.Search(Flag.Unseen);

            foreach (long uid in uids)
            {
                var eml = imap.GetMessageByUID(uid);
                IMail email = new MailBuilder().CreateFromEml(eml);

                Console.WriteLine(email.Subject);

                Console.WriteLine(email.Date);

                Console.WriteLine(email.Text);

                Console.WriteLine(email.Html);

                // Save all attachments to disk
                foreach (MimeData mime in email.Attachments)
                {
                    mime.Save(@"c:\" + mime.SafeFileName);
                }
            }
            imap.Close();
        }
    }
};
by (301k points)
...