Esempio n. 1
0
        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!!
        }
Esempio n. 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
            };
        }