示例#1
0
        public async Task Attachment(MailWindow inboxPage, User user, ConfigModel conf, string Atch, string destination)
        {
            using (ImapClient client = new ImapClient())
            {
                await client.ConnectAsync(conf.ImapServer, conf.ImapPort);

                client.Authenticate(user.Mail, user.Password);
                IMailFolder Folder = client.GetFolder(ListMessages.fold);
                await Folder.OpenAsync(FolderAccess.ReadWrite);

                IList <IMessageSummary> atc = Folder.Fetch(new[] { LastOpenId }, MessageSummaryItems.Body);
                var multipart                 = (BodyPartMultipart)atc.First().Body;
                var attachment                = multipart.BodyParts.OfType <BodyPartBasic>().FirstOrDefault(x => x.FileName == Atch);
                TransferProgress progress     = new TransferProgress();
                Downloads        FileDownload = new Downloads();
                FileDownload.Show();
                var file = Folder.GetBodyPart(LastOpenId, attachment, default, progress);