예제 #1
0
파일: Imap.cs 프로젝트: slieser/sandbox
        public void Mail_holen(Action<Mail> continueWith) {
            using (var imap = new Imap4Client()) {
                imap.Connect(mailAccess.Server);
                imap.Login(mailAccess.Username, mailAccess.Password);

                var box = imap.SelectMailbox("inbox");
                var ids = box.Search("OR (CC @cc.lieser-online.de) (HEADER Envelope-To @cc.lieser-online.de)");
                var fetch = box.Fetch;
                foreach (var id in ids) {
                    var message = fetch.MessageObject(id);

                    var mail = new Mail {
                        Id = id.ToString(), 
                        From = message.From.Email, 
                        To = message.To.Select(x => x.Email).ToArray(), 
                        Cc = message.Cc.Select(x => x.Email).ToArray(),
                        Bcc = message.HeaderFields["Envelope-To"], 
                        Subject = message.Subject, 
                        Text = message.BodyText.Text
                    };
                    continueWith(mail);
                }
            }
            continueWith(null); // End-of-Stream signalisieren!!
        }
예제 #2
0
        public Erinnerungsauftrag Erinnerungsauftrag_erstellen(Mail mail) {
            if (mail == null) {
                    
                return null;
            }

            var adresse = Adresse_extrahieren(mail.Bcc);
            var termin = Termin_bilden(adresse);
            return new Erinnerungsauftrag {
                Termin = termin,
                Mail = mail
            };
        }